diff --git a/app/build.gradle b/app/build.gradle index 3a9b2abd7..9da5ad39b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,6 +45,12 @@ android { throw new GradleException("Could not read version.properties!") } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + incremental = false; + } + //noinspection GroovyAssignabilityCheck buildTypes { release { @@ -52,6 +58,8 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' lintOptions { disable 'MissingTranslation' + checkReleaseBuilds false + abortOnError false } } } @@ -139,7 +147,6 @@ repositories { } } - allprojects { repositories { jcenter() @@ -181,10 +188,9 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.4' implementation 'com.android.volley:volley:1.1.0' implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar' - implementation 'com.larswerkman:lobsterpicker:1.0.1' - implementation 'com.github.zurche:plain-pie:v0.2.2' - implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2' + implementation 'com.github.zurche:plain-pie:v0.2.9' + implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' implementation 'com.github.dexafree:MaterialList:v3.2.2' implementation 'com.github.hotchemi:android-rate:1.0.1' @@ -192,9 +198,10 @@ dependencies { implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar' implementation 'me.dm7.barcodescanner:zxing:1.9.8' implementation 'com.github.jd-alexander:LikeButton:0.2.3' - implementation 'jp.wasabeef:recyclerview-animators:2.2.4' + implementation 'jp.wasabeef:recyclerview-animators:2.3.0' implementation 'com.github.javiersantos:PiracyChecker:1.1' implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar' + implementation("com.mikepenz:materialdrawer:6.0.9@aar") { transitive = true } @@ -205,9 +212,9 @@ dependencies { implementation 'com.github.k0shk0sh:PermissionHelper:1.1.0' implementation 'com.github.zagum:SpeechRecognitionView:1.0.2' implementation 'com.afollestad:digitus:0.3.0' + implementation "com.github.skydoves:colorpickerview:2.0.1" implementation project(':libs:MemorizingTrustManager') - implementation project(path: ':materialIntro_library') implementation project(path: ':SeekArc_library') implementation project(path: ':domoticzapi') diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index d9442ea5b..8a9930b3e 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -21,8 +21,8 @@ --> + xmlns:tools="http://schemas.android.com/tools" + package="nl.hnogames.domoticz"> - - - - - - - - - - - + android:xlargeScreens="true"/> + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + android:protectionLevel="signature"/> + + + + + + + + + + + + + + + + + + + + android:usesCleartextTraffic="true" + tools:replace="android:icon, android:label, android:theme, android:name"> - + - - - - - + + + + + + + + android:scheme="app"/> + android:resource="@xml/nfc_tech_list"/> - + + android:exported="false"> - - - + + + + - + - - - - + + + + + + android:scheme="wear"/> - + + android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"> - + - + - + + android:resource="@xml/appwidgetprovider"/> - + + android:resource="@xml/appwidgetprovider"/> - + @@ -154,199 +178,204 @@ android:name=".Service.FCMMessageInstanceService" android:exported="false"> - + + android:label="Domoticz Widget Config"> - + - + + android:resource="@xml/searchable"/> - + - + - + + android:resource="@xml/smallwidgetprovider"/> + android:label="Domoticz Widget Config"> - + - + + android:resource="@xml/searchable"/> - + + android:label="Domoticz Security Panel Widget Config"> - + - + - + + android:resource="@xml/securitywidgetprovider"/> - + + android:resource="@xml/securitywidgetprovider"/> - - - + + + - - - + + + + - + + android:launchMode="singleTop"> - - + + - + - - - + + + + - - + + android:pathPrefix="/open" + android:scheme="https"/> - + + android:resource="@xml/searchable"/> + android:parentActivityName=".MainActivity"> - - + + + android:value=".MainActivity"/> + android:parentActivityName=".MainActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".MainActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".PlanActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.SettingsActivity"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.GeoSettingsActivity"/> + android:parentActivityName=".SettingsActivity"> - - + + @@ -354,75 +383,77 @@ android:name=".SpeechSettingsActivity" android:configChanges="orientation|screenSize" android:label="@string/category_Speech" - android:parentActivityName=".SettingsActivity" /> + android:parentActivityName=".SettingsActivity"/> + android:parentActivityName=".SettingsActivity"/> + android:theme="@style/AppTheme.NoActionBar"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.ServerListSettingsActivity"/> + android:theme="@style/AppThemeIntro"/> + android:value="@string/googleapikey"/> + android:value="@integer/google_play_services_version"/> + android:value="barcode"/> + android:theme="@style/AppTheme.NoActionBar"> + android:value="nl.hnogames.domoticz.MainActivity"/> + android:theme="@style/AppThemeMain" + android:windowSoftInputMode="adjustPan"> - + - + + + android:value=".GeoSettingsActivity"/> + android:required="false"/> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b1d460e18..0cdcf3b91 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,8 +21,8 @@ --> + xmlns:tools="http://schemas.android.com/tools" + package="nl.hnogames.domoticz"> - - - - - - - - - - - + android:xlargeScreens="true"/> + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + android:protectionLevel="signature"/> + + + + + + + + + + + + + + + + + + + + android:usesCleartextTraffic="true" + tools:replace="android:icon, android:label, android:theme, android:name"> - + - - - - - + + + + + + + + android:scheme="app"/> + android:resource="@xml/nfc_tech_list"/> - + + android:exported="false"> - - - + + + + - + - - - - + + + + + + android:scheme="wear"/> - + + android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"> - + - + - + + android:resource="@xml/appwidgetprovider"/> - + @@ -148,205 +172,210 @@ android:name=".Service.FCMMessageInstanceService" android:exported="false"> - + - + + android:resource="@xml/appwidgetprovider"/> + android:label="Domoticz Widget Config"> - + - + + android:resource="@xml/searchable"/> - + - + - + + android:resource="@xml/smallwidgetprovider"/> + android:label="Domoticz Widget Config"> - + - + + android:resource="@xml/searchable"/> - + + android:label="Domoticz Security Panel Widget Config"> - + - + - + + android:resource="@xml/securitywidgetprovider"/> - + + android:resource="@xml/securitywidgetprovider"/> - + - + - - - + + + + - + + android:launchMode="singleTop"> - - + + - + - - - + + + + - - + + android:pathPrefix="/open" + android:scheme="https"/> - + + android:resource="@xml/searchable"/> + android:parentActivityName=".MainActivity"> - - + + + android:value=".MainActivity"/> + android:parentActivityName=".MainActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".MainActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".PlanActivity"> + android:value=".MainActivity"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.SettingsActivity"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.GeoSettingsActivity"/> + android:parentActivityName=".SettingsActivity"> - - + + @@ -354,75 +383,77 @@ android:name=".SpeechSettingsActivity" android:configChanges="orientation|screenSize" android:label="@string/category_Speech" - android:parentActivityName=".SettingsActivity" /> + android:parentActivityName=".SettingsActivity"/> + android:parentActivityName=".SettingsActivity"/> + android:theme="@style/AppTheme.NoActionBar"/> + android:parentActivityName=".SettingsActivity"> + android:value="nl.hnogames.domoticz.ServerListSettingsActivity"/> + android:theme="@style/AppThemeIntro"/> + android:value="@string/googleapikey"/> + android:value="@integer/google_play_services_version"/> + android:value="barcode"/> + android:theme="@style/AppTheme.NoActionBar"> + android:value="nl.hnogames.domoticz.MainActivity"/> + android:theme="@style/AppThemeMain" + android:windowSoftInputMode="adjustPan"> - + - + + + android:value=".GeoSettingsActivity"/> + android:required="false"/> diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/CamerasAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/CamerasAdapter.java index 066eb9890..cce132cfc 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/CamerasAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/CamerasAdapter.java @@ -22,8 +22,8 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; import android.support.annotation.NonNull; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -73,9 +73,13 @@ public DataObjectHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewTy .inflate(R.layout.camera_row, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.row_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark)); + if ((view.findViewById(R.id.row_wrapper)) != null) + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(mContext, R.color.card_background_dark)); + if ((view.findViewById(R.id.row_global_wrapper)) != null) + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark)); } - return new DataObjectHolder(view); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java index b0cebbd86..416017ea2 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java @@ -24,7 +24,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -35,7 +35,6 @@ import android.widget.Button; import android.widget.CompoundButton; import android.widget.Filter; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.SeekBar; @@ -78,7 +77,7 @@ public class DashboardAdapter extends RecyclerView.Adapter data = null; public ArrayList filteredData = null; - private boolean showAsList = false; + private boolean showAsList; private Domoticz domoticz; private Context context; private switchesClickListener listener; @@ -98,7 +97,6 @@ public DashboardAdapter(Context context, this.context = context; domoticz = new Domoticz(context, AppController.getInstance().getRequestQueue()); - mConfigInfo = serverUtil.getActiveServer().getConfigInfo(context); this.listener = listener; @@ -149,33 +147,19 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.dashboard_row, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) row.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((row.findViewById(R.id.card_global_wrapper)) != null) + row.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((row.findViewById(R.id.row_wrapper)) != null) - (row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((row.findViewById(R.id.row_global_wrapper)) != null) - (row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); - if ((row.findViewById(R.id.day_button)) != null) - (row.findViewById(R.id.day_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.year_button)) != null) - (row.findViewById(R.id.year_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.month_button)) != null) - (row.findViewById(R.id.month_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.week_button)) != null) - (row.findViewById(R.id.week_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.log_button)) != null) - (row.findViewById(R.id.log_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.timer_button)) != null) - (row.findViewById(R.id.timer_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.notifications_button)) != null) - (row.findViewById(R.id.notifications_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((row.findViewById(R.id.on_button)) != null) - (row.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (row.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((row.findViewById(R.id.off_button)) != null) - (row.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (row.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((row.findViewById(R.id.color_button)) != null) - (row.findViewById(R.id.color_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (row.findViewById(R.id.color_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark_status)); } - return new DataObjectHolder(row); } @@ -187,8 +171,9 @@ public void onBindViewHolder(DataObjectHolder holder, final int position) { if (!this.mSharedPrefs.darkThemeEnabled()) { holder.pieView.setInnerBackgroundColor(ContextCompat.getColor(context, R.color.white)); holder.pieView.setTextColor(ContextCompat.getColor(context, R.color.black)); - holder.pieView.setPercentageTextSize(17); } + holder.pieView.setPercentageTextSize(16); + holder.pieView.setPercentageBackgroundColor(ContextCompat.getColor(context, R.color.material_orange_600)); setSwitchRowData(extendedStatusInfo, holder); holder.itemView.setOnClickListener(new View.OnClickListener() { @@ -204,6 +189,12 @@ public boolean onLongClick(View v) { return true; } }); + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); } } @@ -254,6 +245,7 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, case DomoticzValues.Device.Type.Value.ON_OFF: case DomoticzValues.Device.Type.Value.MEDIAPLAYER: case DomoticzValues.Device.Type.Value.DOORLOCK: + case DomoticzValues.Device.Type.Value.DOORLOCKINVERTED: case DomoticzValues.Device.Type.Value.DOORCONTACT: switch (mDeviceInfo.getSwitchType()) { case DomoticzValues.Device.Type.Name.SECURITY: @@ -308,7 +300,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, case DomoticzValues.Device.Type.Value.DIMMER: case DomoticzValues.Device.Type.Value.BLINDPERCENTAGE: case DomoticzValues.Device.Type.Value.BLINDPERCENTAGEINVERTED: - if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB)) { + if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) || + mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) { if (mSharedPrefs.showSwitchesAsButtons()) { setButtons(holder, Buttons.DIMMER_BUTTONS); setDimmerOnOffButtonRowData(mDeviceInfo, holder, true); @@ -507,7 +500,7 @@ private void setSecurityPanelSwitchRowData(DevicesInfo mDeviceInfo, DataObjectHo holder.buttonOn.setText(context.getString(R.string.button_arm)); if (mSharedPrefs.darkThemeEnabled()) - holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + holder.buttonOn.setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); else holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_on)); @@ -1692,6 +1685,14 @@ public void setButtons(DataObjectHolder holder, int button) { holder.signal_level.setVisibility(View.GONE); holder.switch_battery_level.setVisibility(View.GONE); } + if (!mSharedPrefs.showExtraData()) { + holder.infoIcon.setVisibility(View.GONE); + } else { + if (showAsList) { + ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) holder.iconRow.getLayoutParams(); + p.leftMargin = -15; + } + } switch (button) { case Buttons.SWITCH: @@ -1810,40 +1811,42 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { TextView switch_name, signal_level, switch_status, switch_battery_level, switch_dimmer_level; Switch onOffSwitch, dimmerOnOffSwitch; - ImageButton buttonUp, buttonDown, buttonStop; - Button buttonOn, buttonLog, buttonTimer, buttonColor, buttonSetStatus, buttonSet, buttonOff; + ImageView buttonUp, buttonDown, buttonStop; + Button buttonOn, buttonColor, buttonSetStatus, buttonSet, buttonOff; + Chip buttonLog, buttonTimer; Boolean isProtected; ImageView iconRow, iconMode; SeekBar dimmer; Spinner spSelector; LinearLayout extraPanel; PieView pieView; + ImageView infoIcon; public DataObjectHolder(View itemView) { super(itemView); - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); - pieView = (PieView) itemView.findViewById(R.id.pieView); - buttonOn = (Button) itemView.findViewById(R.id.on_button); - buttonOff = (Button) itemView.findViewById(R.id.off_button); - onOffSwitch = (Switch) itemView.findViewById(R.id.switch_button); - signal_level = (TextView) itemView.findViewById(R.id.switch_signal_level); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - switch_name = (TextView) itemView.findViewById(R.id.switch_name); - switch_battery_level = (TextView) itemView.findViewById(R.id.switch_battery_level); - - switch_dimmer_level = (TextView) itemView.findViewById(R.id.switch_dimmer_level); - dimmerOnOffSwitch = (Switch) itemView.findViewById(R.id.switch_dimmer_switch); - dimmer = (SeekBar) itemView.findViewById(R.id.switch_dimmer); - spSelector = (Spinner) itemView.findViewById(R.id.spSelector); - buttonColor = (Button) itemView.findViewById(R.id.color_button); - buttonLog = (Button) itemView.findViewById(R.id.log_button); - buttonTimer = (Button) itemView.findViewById(R.id.timer_button); - buttonUp = (ImageButton) itemView.findViewById(R.id.switch_button_up); - buttonStop = (ImageButton) itemView.findViewById(R.id.switch_button_stop); - buttonDown = (ImageButton) itemView.findViewById(R.id.switch_button_down); - buttonSet = (Button) itemView.findViewById(R.id.set_button); - buttonSetStatus = (Button) itemView.findViewById(R.id.set_button); + extraPanel = itemView.findViewById(R.id.extra_panel); + pieView = itemView.findViewById(R.id.pieView); + buttonOn = itemView.findViewById(R.id.on_button); + buttonOff = itemView.findViewById(R.id.off_button); + onOffSwitch = itemView.findViewById(R.id.switch_button); + signal_level = itemView.findViewById(R.id.switch_signal_level); + iconRow = itemView.findViewById(R.id.rowIcon); + switch_name = itemView.findViewById(R.id.switch_name); + switch_battery_level = itemView.findViewById(R.id.switch_battery_level); + infoIcon = itemView.findViewById(R.id.widget_info_icon); + switch_dimmer_level = itemView.findViewById(R.id.switch_dimmer_level); + dimmerOnOffSwitch = itemView.findViewById(R.id.switch_dimmer_switch); + dimmer = itemView.findViewById(R.id.switch_dimmer); + spSelector = itemView.findViewById(R.id.spSelector); + buttonColor = itemView.findViewById(R.id.color_button); + buttonLog = itemView.findViewById(R.id.log_button); + buttonTimer = itemView.findViewById(R.id.timer_button); + buttonUp = itemView.findViewById(R.id.switch_button_up); + buttonStop = itemView.findViewById(R.id.switch_button_stop); + buttonDown = itemView.findViewById(R.id.switch_button_down); + buttonSet = itemView.findViewById(R.id.set_button); + buttonSetStatus = itemView.findViewById(R.id.set_button); if (buttonLog != null) buttonLog.setVisibility(View.GONE); diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/EventsAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/EventsAdapter.java index 683689a08..8473cc528 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/EventsAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/EventsAdapter.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -85,11 +84,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.event_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -155,11 +155,10 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder public DataObjectHolder(View itemView) { super(itemView); - name = (TextView) itemView.findViewById(R.id.logs_name); - message = (TextView) itemView.findViewById(R.id.logs_message); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - buttonON = (Switch) itemView.findViewById(R.id.switch_button); - + name = itemView.findViewById(R.id.logs_name); + message = itemView.findViewById(R.id.logs_message); + iconRow = itemView.findViewById(R.id.rowIcon); + buttonON = itemView.findViewById(R.id.switch_button); itemView.setOnClickListener(this); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/LocationAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/LocationAdapter.java index c94ff38e1..ccd98fcb8 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/LocationAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/LocationAdapter.java @@ -92,18 +92,22 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(R.layout.geo_row_location, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.remove_button)) != null) - (convertView.findViewById(R.id.remove_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (convertView.findViewById(R.id.remove_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - holder.enable = (CheckBox) convertView.findViewById(R.id.enableSwitch); - holder.name = (TextView) convertView.findViewById(R.id.location_name); - holder.radius = (TextView) convertView.findViewById(R.id.location_radius); - holder.connectedSwitch = (TextView) convertView.findViewById(R.id.location_connectedSwitch); - holder.remove = (Button) convertView.findViewById(R.id.remove_button); + holder.enable = convertView.findViewById(R.id.enableSwitch); + holder.name = convertView.findViewById(R.id.location_name); + holder.radius = convertView.findViewById(R.id.location_radius); + holder.connectedSwitch = convertView.findViewById(R.id.location_connectedSwitch); + holder.remove = convertView.findViewById(R.id.remove_button); holder.name.setText(mLocationInfo.getName()); holder.radius.setText(context.getString(R.string.radius) + ": " + mLocationInfo.getRadius()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/LogAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/LogAdapter.java index 7e93809fe..877df7beb 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/LogAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/LogAdapter.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -79,13 +78,13 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.logs_row_default, parent, false); - if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -141,11 +140,10 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder public DataObjectHolder(View itemView) { super(itemView); - name = (TextView) itemView.findViewById(R.id.logs_name); - datetime = (TextView) itemView.findViewById(R.id.logs_datetime); - message = (TextView) itemView.findViewById(R.id.logs_message); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - + name = itemView.findViewById(R.id.logs_name); + datetime = itemView.findViewById(R.id.logs_datetime); + message = itemView.findViewById(R.id.logs_message); + iconRow = itemView.findViewById(R.id.rowIcon); itemView.setOnClickListener(this); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/NFCAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/NFCAdapter.java index 5e9f207ff..d56b3c97f 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/NFCAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/NFCAdapter.java @@ -96,18 +96,22 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(layoutResourceId, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.remove_button)) != null) - (convertView.findViewById(R.id.remove_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (convertView.findViewById(R.id.remove_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - holder.enable = (CheckBox) convertView.findViewById(R.id.enableNFC); - holder.nfc_name = (TextView) convertView.findViewById(R.id.nfc_name); - holder.nfc_tag_id = (TextView) convertView.findViewById(R.id.nfc_tag_id); - holder.nfc_switch_idx = (TextView) convertView.findViewById(R.id.nfc_switchidx); - holder.remove = (Button) convertView.findViewById(R.id.remove_button); + holder.enable = convertView.findViewById(R.id.enableNFC); + holder.nfc_name = convertView.findViewById(R.id.nfc_name); + holder.nfc_tag_id = convertView.findViewById(R.id.nfc_tag_id); + holder.nfc_switch_idx = convertView.findViewById(R.id.nfc_switchidx); + holder.remove = convertView.findViewById(R.id.remove_button); holder.nfc_name.setText(mNFCInfo.getName()); holder.nfc_tag_id.setText(mNFCInfo.getId()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/NotificationsAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/NotificationsAdapter.java index d2b5102c9..a68ecc605 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/NotificationsAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/NotificationsAdapter.java @@ -81,9 +81,9 @@ public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); convertView = inflater.inflate(layoutResourceId, parent, false); - holder.switch_name = (TextView) convertView.findViewById(R.id.switch_name); - holder.switch_status = (TextView) convertView.findViewById(R.id.switch_battery_level); - holder.signal_level = (TextView) convertView.findViewById(R.id.switch_signal_level); + holder.switch_name = convertView.findViewById(R.id.switch_name); + holder.switch_status = convertView.findViewById(R.id.switch_battery_level); + holder.signal_level = convertView.findViewById(R.id.switch_signal_level); holder.switch_name.setText(mNotificationInfo.getCustomMessage()); String priority = ""; diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/PlansAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/PlansAdapter.java index 8b754e65a..26bb44e34 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/PlansAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/PlansAdapter.java @@ -22,7 +22,7 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -62,7 +62,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.plan_row, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.row_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark)); + if ((view.findViewById(R.id.row_wrapper)) != null) + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(mContext, R.color.card_background_dark)); + if ((view.findViewById(R.id.row_global_wrapper)) != null) + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(mContext, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -99,8 +104,8 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder public DataObjectHolder(View itemView) { super(itemView); - name = (TextView) itemView.findViewById(R.id.name); - devices = (TextView) itemView.findViewById(R.id.devices); + name = itemView.findViewById(R.id.name); + devices = itemView.findViewById(R.id.devices); itemView.setOnClickListener(this); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/QRCodeAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/QRCodeAdapter.java index 0f4b4e728..ab983cdb8 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/QRCodeAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/QRCodeAdapter.java @@ -96,18 +96,21 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(layoutResourceId, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); - + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.remove_button)) != null) - (convertView.findViewById(R.id.remove_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (convertView.findViewById(R.id.remove_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - holder.enable = (CheckBox) convertView.findViewById(R.id.enableNFC); - holder.nfc_name = (TextView) convertView.findViewById(R.id.nfc_name); - holder.nfc_tag_id = (TextView) convertView.findViewById(R.id.nfc_tag_id); - holder.nfc_switch_idx = (TextView) convertView.findViewById(R.id.nfc_switchidx); - holder.remove = (Button) convertView.findViewById(R.id.remove_button); + holder.enable = convertView.findViewById(R.id.enableNFC); + holder.nfc_name = convertView.findViewById(R.id.nfc_name); + holder.nfc_tag_id = convertView.findViewById(R.id.nfc_tag_id); + holder.nfc_switch_idx = convertView.findViewById(R.id.nfc_switchidx); + holder.remove = convertView.findViewById(R.id.remove_button); holder.nfc_name.setText(mQRCodeInfo.getName()); holder.nfc_tag_id.setText(mQRCodeInfo.getId()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/SceneAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/SceneAdapter.java index bdad4798c..dd1aa8e93 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/SceneAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/SceneAdapter.java @@ -22,7 +22,7 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -101,11 +101,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.scene_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -113,7 +114,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { @Override public void onBindViewHolder(final DataObjectHolder holder, final int position) { - + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); if (filteredData != null && filteredData.size() > 0) { final SceneInfo mSceneInfo = filteredData.get(position); @@ -123,17 +129,10 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) setButtons(holder, Buttons.SCENE); if (mSharedPrefs.darkThemeEnabled()) { if ((holder.itemView.findViewById(R.id.on_button)) != null) - (holder.itemView.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (holder.itemView.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((holder.itemView.findViewById(R.id.off_button)) != null) - (holder.itemView.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.log_button)) != null) - (holder.itemView.findViewById(R.id.log_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.notifications_button)) != null) - (holder.itemView.findViewById(R.id.notifications_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.timer_button)) != null) - (holder.itemView.findViewById(R.id.timer_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (holder.itemView.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - if (holder.buttonTimer != null) holder.buttonTimer.setVisibility(View.GONE); if (holder.buttonNotifications != null) @@ -199,15 +198,9 @@ public void onClick(View v) { setButtons(holder, Buttons.GROUP); if (mSharedPrefs.darkThemeEnabled()) { if ((holder.itemView.findViewById(R.id.on_button)) != null) - (holder.itemView.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (holder.itemView.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((holder.itemView.findViewById(R.id.off_button)) != null) - (holder.itemView.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.log_button)) != null) - (holder.itemView.findViewById(R.id.log_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.notifications_button)) != null) - (holder.itemView.findViewById(R.id.notifications_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); - if ((holder.itemView.findViewById(R.id.timer_button)) != null) - (holder.itemView.findViewById(R.id.timer_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (holder.itemView.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } if (holder.buttonTimer != null) @@ -356,33 +349,35 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { ImageView iconRow; LikeButton likeButton; LinearLayout extraPanel; - Button buttonOn, buttonLog, buttonTimer, buttonNotifications, buttonOff; + Button buttonOn, buttonOff; + Chip buttonLog, buttonTimer, buttonNotifications; + ImageView infoIcon; public DataObjectHolder(View itemView) { super(itemView); - buttonOn = (Button) itemView.findViewById(R.id.on_button); - signal_level = (TextView) itemView.findViewById(R.id.switch_signal_level); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - switch_name = (TextView) itemView.findViewById(R.id.switch_name); - switch_battery_level = (TextView) itemView.findViewById(R.id.switch_battery_level); - - buttonLog = (Button) itemView.findViewById(R.id.log_button); - buttonTimer = (Button) itemView.findViewById(R.id.timer_button); - buttonNotifications = (Button) itemView.findViewById(R.id.notifications_button); - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); + buttonOn = itemView.findViewById(R.id.on_button); + signal_level = itemView.findViewById(R.id.switch_signal_level); + iconRow = itemView.findViewById(R.id.rowIcon); + switch_name = itemView.findViewById(R.id.switch_name); + switch_battery_level = itemView.findViewById(R.id.switch_battery_level); + infoIcon = itemView.findViewById(R.id.widget_info_icon); + buttonLog = itemView.findViewById(R.id.log_button); + buttonTimer = itemView.findViewById(R.id.timer_button); + buttonNotifications = itemView.findViewById(R.id.notifications_button); + likeButton = itemView.findViewById(R.id.fav_button); if (buttonTimer != null) buttonTimer.setVisibility(View.GONE); if (buttonNotifications != null) buttonNotifications.setVisibility(View.GONE); - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - buttonLog = (Button) itemView.findViewById(R.id.log_button); - buttonOff = (Button) itemView.findViewById(R.id.off_button); + likeButton = itemView.findViewById(R.id.fav_button); + iconRow = itemView.findViewById(R.id.rowIcon); + buttonLog = itemView.findViewById(R.id.log_button); + buttonOff = itemView.findViewById(R.id.off_button); - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); + extraPanel = itemView.findViewById(R.id.extra_panel); if (extraPanel != null) extraPanel.setVisibility(View.GONE); } @@ -409,10 +404,8 @@ protected FilterResults performFiltering(CharSequence constraint) { sceneInfos.add(filterableObject); } } - results.values = sceneInfos; results.count = sceneInfos.size(); - return results; } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/ServerAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/ServerAdapter.java index f73aff8e7..d20ca2047 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/ServerAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/ServerAdapter.java @@ -93,18 +93,21 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(layoutResourceId, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); - + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.remove_button)) != null) - (convertView.findViewById(R.id.remove_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (convertView.findViewById(R.id.remove_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - holder.enable = (CheckBox) convertView.findViewById(R.id.enableServer); - holder.server_name = (TextView) convertView.findViewById(R.id.server_name); - holder.server_remote_url = (TextView) convertView.findViewById(R.id.server_remote_ip); - holder.server_local_url = (TextView) convertView.findViewById(R.id.server_local_ip); - holder.remove = (Button) convertView.findViewById(R.id.remove_button); + holder.enable = convertView.findViewById(R.id.enableServer); + holder.server_name = convertView.findViewById(R.id.server_name); + holder.server_remote_url = convertView.findViewById(R.id.server_remote_ip); + holder.server_local_url = convertView.findViewById(R.id.server_local_ip); + holder.remove = convertView.findViewById(R.id.remove_button); holder.server_local_url.setText(context.getString(R.string.local) + ": " + mServerInfo.getLocalServerUrl()); holder.server_remote_url.setText(context.getString(R.string.remote) + ": " + mServerInfo.getRemoteServerUrl()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/SpeechAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/SpeechAdapter.java index 36d8f0263..0a6166db3 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/SpeechAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/SpeechAdapter.java @@ -96,18 +96,21 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(layoutResourceId, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); - + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.remove_button)) != null) - (convertView.findViewById(R.id.remove_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (convertView.findViewById(R.id.remove_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - holder.enable = (CheckBox) convertView.findViewById(R.id.enableSpeech); - holder.Speech_name = (TextView) convertView.findViewById(R.id.speech_name); - holder.Speech_tag_id = (TextView) convertView.findViewById(R.id.speech_tag_id); - holder.Speech_switch_idx = (TextView) convertView.findViewById(R.id.speech_switchidx); - holder.remove = (Button) convertView.findViewById(R.id.remove_button); + holder.enable = convertView.findViewById(R.id.enableSpeech); + holder.Speech_name = convertView.findViewById(R.id.speech_name); + holder.Speech_tag_id = convertView.findViewById(R.id.speech_tag_id); + holder.Speech_switch_idx = convertView.findViewById(R.id.speech_switchidx); + holder.remove = convertView.findViewById(R.id.remove_button); holder.Speech_name.setText(mSpeechInfo.getName()); if (!UsefulBits.isEmpty(mSpeechInfo.getSwitchName())) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java index 234c5ac39..691981aa2 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java @@ -24,7 +24,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -35,7 +35,6 @@ import android.widget.Button; import android.widget.CompoundButton; import android.widget.Filter; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.SeekBar; @@ -151,34 +150,21 @@ public Filter getFilter() { public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { View row = null; row = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.dashboard_row_list, parent, false); + .inflate(R.layout.switch_row_list, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) row.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((row.findViewById(R.id.card_global_wrapper)) != null) + row.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((row.findViewById(R.id.row_wrapper)) != null) - (row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (row.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((row.findViewById(R.id.row_global_wrapper)) != null) - (row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); - if ((row.findViewById(R.id.day_button)) != null) - (row.findViewById(R.id.day_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.year_button)) != null) - (row.findViewById(R.id.year_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.month_button)) != null) - (row.findViewById(R.id.month_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.week_button)) != null) - (row.findViewById(R.id.week_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.log_button)) != null) - (row.findViewById(R.id.log_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.timer_button)) != null) - (row.findViewById(R.id.timer_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if ((row.findViewById(R.id.notifications_button)) != null) - (row.findViewById(R.id.notifications_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (row.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((row.findViewById(R.id.on_button)) != null) - (row.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (row.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((row.findViewById(R.id.off_button)) != null) - (row.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (row.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((row.findViewById(R.id.color_button)) != null) - (row.findViewById(R.id.color_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); + (row.findViewById(R.id.color_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark_status)); } return new DataObjectHolder(row); @@ -197,7 +183,12 @@ public void onClick(View v) { handleLogButtonClick(v.getId()); } }); - + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); if (holder.likeButton != null) { holder.likeButton.setId(extendedStatusInfo.getIdx()); holder.likeButton.setLiked(extendedStatusInfo.getFavoriteBoolean()); @@ -292,6 +283,7 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, case DomoticzValues.Device.Type.Value.ON_OFF: case DomoticzValues.Device.Type.Value.MEDIAPLAYER: case DomoticzValues.Device.Type.Value.DOORLOCK: + case DomoticzValues.Device.Type.Value.DOORLOCKINVERTED: case DomoticzValues.Device.Type.Value.DOORCONTACT: switch (mDeviceInfo.getSwitchType()) { case DomoticzValues.Device.Type.Name.SECURITY: @@ -352,7 +344,8 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, case DomoticzValues.Device.Type.Value.DIMMER: case DomoticzValues.Device.Type.Value.BLINDPERCENTAGE: case DomoticzValues.Device.Type.Value.BLINDPERCENTAGEINVERTED: - if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB)) { + if (mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) || + mDeviceInfo.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) { if (mSharedPrefs.showSwitchesAsButtons()) { setButtons(holder, Buttons.DIMMER_BUTTONS); setDimmerOnOffButtonRowData(mDeviceInfo, holder, true); @@ -509,7 +502,7 @@ private void setSecurityPanelSwitchRowData(DevicesInfo mDeviceInfo, DataObjectHo holder.buttonOn.setText(context.getString(R.string.button_arm)); if (mSharedPrefs.darkThemeEnabled()) - holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + holder.buttonOn.setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); else holder.buttonOn.setBackground(ContextCompat.getDrawable(context, R.drawable.button_on)); @@ -1796,49 +1789,49 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { TextView switch_name, signal_level, switch_status, switch_battery_level, switch_dimmer_level; Switch onOffSwitch, dimmerOnOffSwitch; - ImageButton buttonUp, buttonDown, buttonStop; - Button buttonOn, buttonLog, buttonTimer, buttonColor, buttonSetStatus, buttonSet, buttonOff, buttonNotifications; + ImageView buttonUp, buttonDown, buttonStop; + Button buttonOn, buttonColor, buttonSetStatus, buttonSet, buttonOff; + Chip buttonLog, buttonTimer, buttonNotifications; Boolean isProtected; LikeButton likeButton; ImageView iconRow, iconMode; SeekBar dimmer; Spinner spSelector; LinearLayout extraPanel; + ImageView infoIcon; public DataObjectHolder(View itemView) { super(itemView); - buttonOn = (Button) itemView.findViewById(R.id.on_button); - buttonOff = (Button) itemView.findViewById(R.id.off_button); - buttonSetStatus = (Button) itemView.findViewById(R.id.set_button); - - onOffSwitch = (Switch) itemView.findViewById(R.id.switch_button); - signal_level = (TextView) itemView.findViewById(R.id.switch_signal_level); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - switch_name = (TextView) itemView.findViewById(R.id.switch_name); - switch_battery_level = (TextView) itemView.findViewById(R.id.switch_battery_level); - - switch_dimmer_level = (TextView) itemView.findViewById(R.id.switch_dimmer_level); - dimmerOnOffSwitch = (Switch) itemView.findViewById(R.id.switch_dimmer_switch); - dimmer = (SeekBar) itemView.findViewById(R.id.switch_dimmer); - spSelector = (Spinner) itemView.findViewById(R.id.spSelector); - buttonColor = (Button) itemView.findViewById(R.id.color_button); - buttonLog = (Button) itemView.findViewById(R.id.log_button); - buttonTimer = (Button) itemView.findViewById(R.id.timer_button); - buttonUp = (ImageButton) itemView.findViewById(R.id.switch_button_up); - buttonNotifications = (Button) itemView.findViewById(R.id.notifications_button); - buttonStop = (ImageButton) itemView.findViewById(R.id.switch_button_stop); - buttonDown = (ImageButton) itemView.findViewById(R.id.switch_button_down); - buttonSet = (Button) itemView.findViewById(R.id.set_button); - - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); - + buttonOn = itemView.findViewById(R.id.on_button); + buttonOff = itemView.findViewById(R.id.off_button); + buttonSetStatus = itemView.findViewById(R.id.set_button); + + onOffSwitch = itemView.findViewById(R.id.switch_button); + signal_level = itemView.findViewById(R.id.switch_signal_level); + iconRow = itemView.findViewById(R.id.rowIcon); + switch_name = itemView.findViewById(R.id.switch_name); + switch_battery_level = itemView.findViewById(R.id.switch_battery_level); + + switch_dimmer_level = itemView.findViewById(R.id.switch_dimmer_level); + dimmerOnOffSwitch = itemView.findViewById(R.id.switch_dimmer_switch); + dimmer = itemView.findViewById(R.id.switch_dimmer); + spSelector = itemView.findViewById(R.id.spSelector); + buttonColor = itemView.findViewById(R.id.color_button); + buttonLog = itemView.findViewById(R.id.log_button); + buttonTimer = itemView.findViewById(R.id.timer_button); + buttonUp = itemView.findViewById(R.id.switch_button_up); + buttonNotifications = itemView.findViewById(R.id.notifications_button); + buttonStop = itemView.findViewById(R.id.switch_button_stop); + buttonDown = itemView.findViewById(R.id.switch_button_down); + buttonSet = itemView.findViewById(R.id.set_button); + infoIcon = itemView.findViewById(R.id.widget_info_icon); + likeButton = itemView.findViewById(R.id.fav_button); if (buttonLog != null) buttonLog.setVisibility(View.GONE); if (buttonTimer != null) buttonTimer.setVisibility(View.GONE); - - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); + extraPanel = itemView.findViewById(R.id.extra_panel); if (extraPanel != null) extraPanel.setVisibility(View.GONE); } @@ -1869,7 +1862,6 @@ protected FilterResults performFiltering(CharSequence constraint) { } results.values = devicesInfos; results.count = devicesInfos.size(); - return results; } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/TemperatureAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/TemperatureAdapter.java index 56f2968a4..5d735f9bc 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/TemperatureAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/TemperatureAdapter.java @@ -23,7 +23,7 @@ import android.content.Context; import android.content.res.TypedArray; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -107,11 +107,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.temperature_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -124,15 +125,15 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) final TemperatureInfo mTemperatureInfo = filteredData.get(position); if (mSharedPrefs.darkThemeEnabled()) { - holder.dayButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.monthButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.yearButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.weekButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - if (holder.setButton != null) - holder.setButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + holder.setButton.setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } - + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); holder.isProtected = mTemperatureInfo.isProtected(); String sign = mConfigInfo != null ? mConfigInfo.getTempSign() : "C"; @@ -164,13 +165,12 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) holder.pieView.setVisibility(View.GONE); } else { holder.pieView.setVisibility(View.VISIBLE); - if (!this.mSharedPrefs.darkThemeEnabled()) { holder.pieView.setInnerBackgroundColor(ContextCompat.getColor(context, R.color.white)); holder.pieView.setTextColor(ContextCompat.getColor(context, R.color.black)); - holder.pieView.setPercentageTextSize(17); } - + holder.pieView.setPercentageTextSize(16); + holder.pieView.setPercentageBackgroundColor(ContextCompat.getColor(context, R.color.material_orange_600)); double temp = mTemperatureInfo.getTemperature(); if (!UsefulBits.isEmpty(sign) && !sign.equals("C")) temp = temp / 2; @@ -341,33 +341,34 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { ImageView iconRow; ImageView iconMode; Button setButton; - Button dayButton; - Button monthButton; - Button weekButton; - Button yearButton; + Chip dayButton; + Chip monthButton; + Chip weekButton; + Chip yearButton; Boolean isProtected; LikeButton likeButton; LinearLayout extraPanel; PieView pieView; + ImageView infoIcon; public DataObjectHolder(View itemView) { super(itemView); - - name = (TextView) itemView.findViewById(R.id.temperature_name); - data = (TextView) itemView.findViewById(R.id.temperature_data); - data2 = (TextView) itemView.findViewById(R.id.temperature_data2); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - iconMode = (ImageView) itemView.findViewById(R.id.mode_icon); - pieView = (PieView) itemView.findViewById(R.id.pieView); - - dayButton = (Button) itemView.findViewById(R.id.day_button); - monthButton = (Button) itemView.findViewById(R.id.month_button); - yearButton = (Button) itemView.findViewById(R.id.year_button); - weekButton = (Button) itemView.findViewById(R.id.week_button); - setButton = (Button) itemView.findViewById(R.id.set_button); - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); - - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); + infoIcon = itemView.findViewById(R.id.widget_info_icon); + name = itemView.findViewById(R.id.temperature_name); + data = itemView.findViewById(R.id.temperature_data); + data2 = itemView.findViewById(R.id.temperature_data2); + iconRow = itemView.findViewById(R.id.rowIcon); + iconMode = itemView.findViewById(R.id.mode_icon); + pieView = itemView.findViewById(R.id.pieView); + + dayButton = itemView.findViewById(R.id.day_button); + monthButton = itemView.findViewById(R.id.month_button); + yearButton = itemView.findViewById(R.id.year_button); + weekButton = itemView.findViewById(R.id.week_button); + setButton = itemView.findViewById(R.id.set_button); + likeButton = itemView.findViewById(R.id.fav_button); + + extraPanel = itemView.findViewById(R.id.extra_panel); if (extraPanel != null) extraPanel.setVisibility(View.GONE); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/TimersAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/TimersAdapter.java index bbd83d4db..9fa2a76a6 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/TimersAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/TimersAdapter.java @@ -85,15 +85,17 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(layoutResourceId, parent, false); if (mSharedPrefs.darkThemeEnabled()) { + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.row_wrapper)) != null) - (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((convertView.findViewById(R.id.row_global_wrapper)) != null) - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } - holder.switch_name = (TextView) convertView.findViewById(R.id.switch_name); - holder.switch_status = (TextView) convertView.findViewById(R.id.switch_battery_level); - holder.signal_level = (TextView) convertView.findViewById(R.id.switch_signal_level); + holder.switch_name = convertView.findViewById(R.id.switch_name); + holder.switch_status = convertView.findViewById(R.id.switch_battery_level); + holder.signal_level = convertView.findViewById(R.id.switch_signal_level); holder.switch_name.setText(mSwitchTimerInfo.getActive()); String commando = ""; if (mSwitchTimerInfo.getCmd() == 0) diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/UserVariablesAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/UserVariablesAdapter.java index e2cf197f5..c399d62df 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/UserVariablesAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/UserVariablesAdapter.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -86,13 +85,14 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.vars_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.set_uservar)) != null) - (view.findViewById(R.id.set_uservar)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (view.findViewById(R.id.set_uservar)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } return new DataObjectHolder(view); @@ -144,12 +144,11 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder public DataObjectHolder(View itemView) { super(itemView); - name = (TextView) itemView.findViewById(R.id.logs_name); - datetime = (TextView) itemView.findViewById(R.id.logs_datetime); - message = (TextView) itemView.findViewById(R.id.logs_message); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - set = (Button) itemView.findViewById(R.id.set_uservar); - + name = itemView.findViewById(R.id.logs_name); + datetime = itemView.findViewById(R.id.logs_datetime); + message = itemView.findViewById(R.id.logs_message); + iconRow = itemView.findViewById(R.id.rowIcon); + set = itemView.findViewById(R.id.set_uservar); itemView.setOnClickListener(this); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java index 01e9bc087..9cba82d7b 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java @@ -22,7 +22,7 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -98,17 +98,18 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.utilities_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.on_button)) != null) - (view.findViewById(R.id.on_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (view.findViewById(R.id.on_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((view.findViewById(R.id.off_button)) != null) - (view.findViewById(R.id.off_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (view.findViewById(R.id.off_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); if ((view.findViewById(R.id.set_button)) != null) - (view.findViewById(R.id.set_button)).setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + (view.findViewById(R.id.set_button)).setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } return new DataObjectHolder(view); @@ -146,6 +147,12 @@ public void onClick(View v) { listener.onItemClicked(v, position); } }); + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); } } @@ -180,9 +187,6 @@ private void CreateTextRow(DataObjectHolder holder, UtilitiesInfo mUtilitiesInfo holder.data.append(" " + context.getString(R.string.today) + ": " + mUtilitiesInfo.getCounterToday()); if (mUtilitiesInfo.getCounter() != null && mUtilitiesInfo.getCounter().length() > 0 && !mUtilitiesInfo.getCounter().equals(mUtilitiesInfo.getData())) holder.data.append(" " + context.getString(R.string.total) + ": " + mUtilitiesInfo.getCounter()); - if (mSharedPrefs.darkThemeEnabled()) { - holder.buttonLog.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - } if (holder.likeButton != null) { holder.likeButton.setId(mUtilitiesInfo.getIdx()); @@ -218,13 +222,6 @@ private void handleLogButtonClick(int idx) { private void CreateDefaultRow(DataObjectHolder holder, UtilitiesInfo mUtilitiesInfo) { holder.isProtected = mUtilitiesInfo.isProtected(); - if (mSharedPrefs.darkThemeEnabled()) { - holder.dayButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.monthButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.yearButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.weekButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - } - holder.name.setText(mUtilitiesInfo.getName()); holder.data.setText(context.getString(R.string.data) + ": " + mUtilitiesInfo.getData()); holder.hardware.setText(context.getString(R.string.hardware) + ": " + mUtilitiesInfo.getHardwareName()); @@ -321,13 +318,6 @@ private void CreateThermostatRow(DataObjectHolder holder, UtilitiesInfo mUtiliti if (holder.isProtected) holder.on_button.setEnabled(false); - if (mSharedPrefs.darkThemeEnabled()) { - holder.dayButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.monthButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.yearButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.weekButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - } - holder.on_button.setText(context.getString(R.string.set_temperature)); holder.on_button.setId(mUtilitiesInfo.getIdx()); holder.on_button.setOnClickListener(new View.OnClickListener() { @@ -337,7 +327,7 @@ public void onClick(View v) { } }); if (mSharedPrefs.darkThemeEnabled()) { - holder.on_button.setBackground(ContextCompat.getDrawable(context, R.drawable.button_status_dark)); + holder.on_button.setBackgroundColor(ContextCompat.getColor(context, R.color.button_dark)); } holder.dayButton.setId(mUtilitiesInfo.getIdx()); @@ -466,33 +456,34 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { ImageView iconRow; Boolean isProtected; - Button dayButton; - Button monthButton; - Button yearButton; - Button weekButton; - Button buttonLog; + Chip dayButton; + Chip monthButton; + Chip yearButton; + Chip weekButton; + Chip buttonLog; Button on_button; - + ImageView infoIcon; LikeButton likeButton; LinearLayout extraPanel; public DataObjectHolder(View itemView) { super(itemView); - dayButton = (Button) itemView.findViewById(R.id.day_button); - monthButton = (Button) itemView.findViewById(R.id.month_button); - yearButton = (Button) itemView.findViewById(R.id.year_button); - weekButton = (Button) itemView.findViewById(R.id.week_button); - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); - - on_button = (Button) itemView.findViewById(R.id.on_button); - name = (TextView) itemView.findViewById(R.id.utilities_name); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - buttonLog = (Button) itemView.findViewById(R.id.log_button); - data = (TextView) itemView.findViewById(R.id.utilities_data); - hardware = (TextView) itemView.findViewById(R.id.utilities_hardware); - - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); + dayButton = itemView.findViewById(R.id.day_button); + monthButton = itemView.findViewById(R.id.month_button); + yearButton = itemView.findViewById(R.id.year_button); + weekButton = itemView.findViewById(R.id.week_button); + likeButton = itemView.findViewById(R.id.fav_button); + + infoIcon = itemView.findViewById(R.id.widget_info_icon); + on_button = itemView.findViewById(R.id.on_button); + name = itemView.findViewById(R.id.utilities_name); + iconRow = itemView.findViewById(R.id.rowIcon); + buttonLog = itemView.findViewById(R.id.log_button); + data = itemView.findViewById(R.id.utilities_data); + hardware = itemView.findViewById(R.id.utilities_hardware); + + extraPanel = itemView.findViewById(R.id.extra_panel); if (extraPanel != null) extraPanel.setVisibility(View.GONE); } diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/WeatherAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/WeatherAdapter.java index d34a240a3..4053cc25e 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/WeatherAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/WeatherAdapter.java @@ -22,14 +22,13 @@ package nl.hnogames.domoticz.Adapters; import android.content.Context; -import android.graphics.Color; +import android.support.design.chip.Chip; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.Filter; import android.widget.ImageView; import android.widget.LinearLayout; @@ -109,11 +108,12 @@ public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { .inflate(R.layout.weather_row_default, parent, false); if (mSharedPrefs.darkThemeEnabled()) { - ((android.support.v7.widget.CardView) view.findViewById(R.id.card_global_wrapper)).setCardBackgroundColor(Color.parseColor("#3F3F3F")); + if ((view.findViewById(R.id.card_global_wrapper)) != null) + view.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_wrapper)) != null) - (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.drawable.bordershadowdark)); + (view.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); if ((view.findViewById(R.id.row_global_wrapper)) != null) - (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.background_dark)); + (view.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } return new DataObjectHolder(view); @@ -136,12 +136,12 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) windSign = mConfigInfo.getWindSign(); } - if (mSharedPrefs.darkThemeEnabled()) { - holder.dayButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.monthButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.yearButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - holder.weekButton.setBackground(ContextCompat.getDrawable(context, R.drawable.button_dark_status)); - } + holder.infoIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.onItemLongClicked(position); + } + }); holder.isProtected = mWeatherInfo.isProtected(); holder.name.setText(mWeatherInfo.getName()); @@ -181,8 +181,9 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) if (!this.mSharedPrefs.darkThemeEnabled()) { holder.pieView.setInnerBackgroundColor(ContextCompat.getColor(context, R.color.white)); holder.pieView.setTextColor(ContextCompat.getColor(context, R.color.black)); - holder.pieView.setPercentageTextSize(17); } + holder.pieView.setPercentageTextSize(16); + holder.pieView.setPercentageBackgroundColor(ContextCompat.getColor(context, R.color.material_orange_600)); double temp = mWeatherInfo.getTemp(); if (!tempSign.equals("C")) @@ -298,31 +299,30 @@ public static class DataObjectHolder extends RecyclerView.ViewHolder { TextView hardware; ImageView iconRow; Boolean isProtected; - Button dayButton; - Button monthButton; - Button yearButton; - Button weekButton; + Chip dayButton; + Chip monthButton; + Chip yearButton; + Chip weekButton; LikeButton likeButton; LinearLayout extraPanel; PieView pieView; + ImageView infoIcon; public DataObjectHolder(View itemView) { super(itemView); - - pieView = (PieView) itemView.findViewById(R.id.pieView); + pieView = itemView.findViewById(R.id.pieView); + infoIcon = itemView.findViewById(R.id.widget_info_icon); pieView.setVisibility(View.GONE); - - dayButton = (Button) itemView.findViewById(R.id.day_button); - monthButton = (Button) itemView.findViewById(R.id.month_button); - yearButton = (Button) itemView.findViewById(R.id.year_button); - weekButton = (Button) itemView.findViewById(R.id.week_button); - likeButton = (LikeButton) itemView.findViewById(R.id.fav_button); - name = (TextView) itemView.findViewById(R.id.weather_name); - iconRow = (ImageView) itemView.findViewById(R.id.rowIcon); - data = (TextView) itemView.findViewById(R.id.weather_data); - hardware = (TextView) itemView.findViewById(R.id.weather_hardware); - - extraPanel = (LinearLayout) itemView.findViewById(R.id.extra_panel); + dayButton = itemView.findViewById(R.id.day_button); + monthButton = itemView.findViewById(R.id.month_button); + yearButton = itemView.findViewById(R.id.year_button); + weekButton = itemView.findViewById(R.id.week_button); + likeButton = itemView.findViewById(R.id.fav_button); + name = itemView.findViewById(R.id.weather_name); + iconRow = itemView.findViewById(R.id.rowIcon); + data = itemView.findViewById(R.id.weather_data); + hardware = itemView.findViewById(R.id.weather_hardware); + extraPanel = itemView.findViewById(R.id.extra_panel); if (extraPanel != null) extraPanel.setVisibility(View.GONE); } @@ -331,18 +331,14 @@ public DataObjectHolder(View itemView) { private class ItemFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { - String filterString = constraint.toString().toLowerCase(); - FilterResults results = new FilterResults(); - final ArrayList list = data; int count = list.size(); final ArrayList weatherInfos = new ArrayList<>(count); WeatherInfo filterableObject; - for (int i = 0; i < count; i++) { filterableObject = list.get(i); if (filterableObject.getName().toLowerCase().contains(filterString)) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/WidgetsAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/WidgetsAdapter.java index d74f3fb5e..10c46093f 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/WidgetsAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/WidgetsAdapter.java @@ -23,6 +23,7 @@ import android.app.Activity; import android.content.Context; +import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -104,7 +105,12 @@ public View getView(int position, View convertView, ViewGroup parent) { convertView.setTag(holder); if (mSharedPrefs.darkThemeEnabled()) { - (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(context.getResources().getColor(R.color.background_dark)); + if ((convertView.findViewById(R.id.card_global_wrapper)) != null) + convertView.findViewById(R.id.card_global_wrapper).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_wrapper)) != null) + (convertView.findViewById(R.id.row_wrapper)).setBackground(ContextCompat.getDrawable(context, R.color.card_background_dark)); + if ((convertView.findViewById(R.id.row_global_wrapper)) != null) + (convertView.findViewById(R.id.row_global_wrapper)).setBackgroundColor(ContextCompat.getColor(context, R.color.card_background_dark)); } setDefaultRowData(deviceInfo, holder); @@ -117,10 +123,10 @@ private View setDefaultRowId(ViewHolder holder) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); View row = inflater.inflate(layoutResourceId, null); - holder.signal_level = (TextView) row.findViewById(R.id.switch_signal_level); - holder.iconRow = (ImageView) row.findViewById(R.id.rowIcon); - holder.switch_name = (TextView) row.findViewById(R.id.switch_name); - holder.switch_battery_level = (TextView) row.findViewById(R.id.switch_battery_level); + holder.signal_level = row.findViewById(R.id.switch_signal_level); + holder.iconRow = row.findViewById(R.id.rowIcon); + holder.switch_name = row.findViewById(R.id.switch_name); + holder.switch_battery_level = row.findViewById(R.id.switch_battery_level); return row; } diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Camera.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Camera.java index 0702f5cc3..fd4baccae 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Camera.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Camera.java @@ -81,6 +81,12 @@ public void onAttach(Context context) { mSharedPrefs = new SharedPrefUtil(context); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + private void processImage() { // Get access to the URI for the bitmap File file = new File(url); diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Cameras.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Cameras.java index 87ab18174..a6315d055 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Cameras.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Cameras.java @@ -64,6 +64,7 @@ import nl.hnogames.domoticz.app.DomoticzCardFragment; import nl.hnogames.domoticzapi.Containers.CameraInfo; import nl.hnogames.domoticzapi.Interfaces.CameraReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Cameras extends DomoticzCardFragment implements DomoticzFragmentListener, OnPermissionCallback { @@ -97,6 +98,7 @@ public void refreshFragment() { @Override public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); super.onActivityCreated(savedInstanceState); } @@ -122,6 +124,7 @@ private void processImage(Bitmap savePic, String title) { @Override public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); this.context = context; mSharedPrefs = new SharedPrefUtil(context); if (getActionBar() != null) @@ -264,7 +267,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheCameras = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(context); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheCameras = (ArrayList) SerializableManager.readSerializedObject(context, "Cameras"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Dashboard.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Dashboard.java index 4dcf7139e..b27d6c130 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Dashboard.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Dashboard.java @@ -22,8 +22,10 @@ package nl.hnogames.domoticz.Fragments; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Color; import android.os.AsyncTask; +import android.os.Bundle; import android.os.Parcelable; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; @@ -34,6 +36,9 @@ import com.afollestad.materialdialogs.DialogAction; import com.afollestad.materialdialogs.MaterialDialog; +import com.skydoves.colorpickerview.ColorEnvelope; +import com.skydoves.colorpickerview.ColorPickerDialog; +import com.skydoves.colorpickerview.listeners.ColorEnvelopeListener; import java.util.ArrayList; import java.util.List; @@ -45,12 +50,12 @@ import nl.hnogames.domoticz.Interfaces.switchesClickListener; import nl.hnogames.domoticz.MainActivity; import nl.hnogames.domoticz.R; -import nl.hnogames.domoticz.UI.ColorPickerDialog; import nl.hnogames.domoticz.UI.DeviceInfoDialog; import nl.hnogames.domoticz.UI.PasswordDialog; import nl.hnogames.domoticz.UI.ScheduledTemperatureDialog; import nl.hnogames.domoticz.UI.SecurityPanelDialog; import nl.hnogames.domoticz.UI.TemperatureDialog; +import nl.hnogames.domoticz.UI.WWColorPickerDialog; import nl.hnogames.domoticz.Utils.SerializableManager; import nl.hnogames.domoticz.Utils.UsefulBits; import nl.hnogames.domoticz.app.DomoticzDashboardFragment; @@ -80,14 +85,20 @@ public class Dashboard extends DomoticzDashboardFragment implements DomoticzFrag private SlideInBottomAnimationAdapter alphaSlideIn; + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + // if (getActionBar() != null) + // getActionBar().setTitle(R.string.title_dashboard); + } @Override @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; - if (getActionBar() != null) - getActionBar().setTitle(R.string.title_dashboard); } @Override @@ -254,10 +265,14 @@ public void onRefresh() { private void showInfoDialog(final DevicesInfo mSwitch) { DeviceInfoDialog infoDialog = new DeviceInfoDialog( mContext, + mDomoticz, mSwitch, R.layout.dialog_switch_info); - infoDialog.setIdx(String.valueOf(mSwitch.getIdx())); + try { + infoDialog.setColorLight(mSwitch.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) || mSwitch.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)); + } catch (Exception ex) { + } infoDialog.setLastUpdate(mSwitch.getLastUpdate()); infoDialog.setSignalLevel(String.valueOf(mSwitch.getSignalLevel())); infoDialog.setBatteryLevel(String.valueOf(mSwitch.getBatteryLevel())); @@ -361,7 +376,8 @@ private void toggleSwitch(final DevicesInfo clickedSwitch, final boolean checked int jsonAction; int jsonUrl = DomoticzValues.Json.Url.Set.SWITCHES; if (clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDS || - clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDPERCENTAGE) { + clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDPERCENTAGE || + clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.DOORLOCKINVERTED) { if (checked) jsonAction = DomoticzValues.Device.Switch.Action.OFF; else jsonAction = DomoticzValues.Device.Switch.Action.ON; } else { @@ -508,49 +524,117 @@ public void onLikeButtonClick(int idx, boolean checked) { @Override @DebugLog public void onColorButtonClick(final int idx) { - ColorPickerDialog colorDialog = new ColorPickerDialog( - mContext, idx); - colorDialog.show(); - colorDialog.onDismissListener(new ColorPickerDialog.DismissListener() { - @Override - @DebugLog - public void onDismiss(final int selectedColor) { - if (getDevice(idx).isProtected()) { - PasswordDialog passwordDialog = new PasswordDialog( - mContext, mDomoticz); - passwordDialog.show(); - passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { - @Override - @DebugLog - public void onDismiss(String password) { - setColor(selectedColor, idx, password); - } + if (getDevice(idx).getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) { + WWColorPickerDialog colorDialog = new WWColorPickerDialog(mContext, + getDevice(idx).getIdx()); + colorDialog.show(); + colorDialog.onDismissListener(new WWColorPickerDialog.DismissListener() { + @Override + public void onDismiss(final int kelvin) { + if (getDevice(idx).isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setKelvinColor(kelvin, idx, password, true); + } - @Override - public void onCancel() { - } - }); - } else - setColor(selectedColor, idx, null); - } + @Override + public void onCancel() { + } + }); + } else + setKelvinColor(kelvin, idx, null, true); + } - @Override - @DebugLog - public void onChangeColor(final int selectedColor) { - if (!getDevice(idx).isProtected()) { - setColor(selectedColor, idx, null); + @Override + public void onChangeColor(int kelvin) { + if (!getDevice(idx).isProtected()) + setKelvinColor(kelvin, idx, null, false); } - } - }); + }); + } else { + ColorPickerDialog.Builder builder = new ColorPickerDialog.Builder(getContext()); + builder.setTitle(getString(R.string.choose_color)); + builder.setPositiveButton(getString(R.string.ok), new ColorEnvelopeListener() { + @Override + public void onColorSelected(final ColorEnvelope envelope, boolean fromUser) { + if (getDevice(idx).isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setRGBColor(envelope.getColor(), idx, password, true); + } + + @Override + public void onCancel() { + } + }); + } else + setRGBColor(envelope.getColor(), idx, null, true); + } + }); + builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + } + }); + builder.show(); + } } - private void setColor(int selectedColor, final int idx, final String password) { + private void setKelvinColor(int kelvin, final int idx, final String password, final boolean selected) { + mDomoticz.setAction(idx, + DomoticzValues.Json.Url.Set.KELVIN, + DomoticzValues.Device.Dimmer.Action.KELVIN, + kelvin, + password, + new setCommandReceiver() { + @Override + @DebugLog + public void onReceiveResult(String result) { + if (selected) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getDevice(idx).getName(), Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.color_set); + } + } + + @Override + @DebugLog + public void onError(Exception error) { + if (selected) { + if (!UsefulBits.isEmpty(password)) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); + } else { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.error_color); + } + } + } + }); + } + + private void setRGBColor(int selectedColor, final int idx, final String password, final boolean selected) { double[] hsv = UsefulBits.rgb2hsv(Color.red(selectedColor), Color.green(selectedColor), Color.blue(selectedColor)); if (hsv == null || hsv.length <= 0) return; - Log.v(TAG, "Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); - addDebugText("Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); + if (selected) { + Log.v(TAG, "Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); + addDebugText("Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); + } boolean isWhite = false; long hue = Math.round(hsv[0]); @@ -567,22 +651,26 @@ private void setColor(int selectedColor, final int idx, final String password) { @Override @DebugLog public void onReceiveResult(String result) { - UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getDevice(idx).getName(), Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.color_set); + if (selected) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getDevice(idx).getName(), Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.color_set); + } } @Override @DebugLog public void onError(Exception error) { - if (!UsefulBits.isEmpty(password)) { - UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); - } else { - UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.error_color); + if (selected) { + if (!UsefulBits.isEmpty(password)) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); + } else { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.error_color); + } } } }); @@ -1046,7 +1134,6 @@ public void errorHandling(Exception error, CoordinatorLayout coordinatorLayout) if (isAdded()) { if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(false); - super.errorHandling(error, this.coordinatorLayout); } } @@ -1058,10 +1145,11 @@ private class GetCachedDataTask extends AsyncTask { protected Boolean doInBackground(Boolean... geto) { if (mPhoneConnectionUtil == null) mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheSwitches = (ArrayList) SerializableManager.readSerializedObject(mContext, "Dashboard"); - } catch (Exception ex) { } + } catch (Exception ex) { + } } return true; } diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Events.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Events.java index 6fe09e10e..a9ae1daec 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Events.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Events.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.AsyncTask; +import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import java.util.ArrayList; @@ -39,6 +40,7 @@ import nl.hnogames.domoticzapi.DomoticzValues; import nl.hnogames.domoticzapi.Interfaces.EventReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Events extends DomoticzRecyclerFragment implements DomoticzFragmentListener { @@ -65,11 +67,18 @@ public void onConnectionFailed() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; if (getActionBar() != null) getActionBar().setTitle(R.string.title_events); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override @DebugLog public void Filter(String text) { @@ -159,7 +168,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheEventInfos = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheEventInfos = (ArrayList) SerializableManager.readSerializedObject(mContext, "Events"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java index c7c92a25f..205706c1c 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java @@ -101,11 +101,18 @@ public void onConnectionFailed() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); this.context = context; mDomoticz = new Domoticz(context, AppController.getInstance().getRequestQueue()); mSharedPrefs = new SharedPrefUtil(context); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override @DebugLog public void onCreate(Bundle savedInstanceState) { @@ -192,12 +199,6 @@ public String getFormattedValue(float value, AxisBase axis) { return root; } - @Override - @DebugLog - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - } - public void getGraphs() { chart.setVisibility(View.GONE); new Thread() { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Logs.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Logs.java index e770de971..3e3a18368 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Logs.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Logs.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.AsyncTask; +import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import java.util.ArrayList; @@ -36,15 +37,14 @@ import nl.hnogames.domoticz.app.DomoticzRecyclerFragment; import nl.hnogames.domoticzapi.Containers.LogInfo; import nl.hnogames.domoticzapi.Interfaces.LogsReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Logs extends DomoticzRecyclerFragment implements DomoticzFragmentListener { - private LogAdapter adapter; private Context mContext; private String filter = ""; private SlideInBottomAnimationAdapter alphaSlideIn; - @Override public void onConnectionFailed() { new GetCachedDataTask().execute(); @@ -62,11 +62,18 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; if (getActionBar() != null) getActionBar().setTitle(R.string.title_logs); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override @DebugLog public void Filter(String text) { @@ -143,7 +150,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheLogs = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheLogs = (ArrayList) SerializableManager.readSerializedObject(mContext, "Logs"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/MainPager.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/MainPager.java new file mode 100644 index 000000000..8893fa5ae --- /dev/null +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/MainPager.java @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2015 Domoticz - Mark Heinis + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package nl.hnogames.domoticz.Fragments; + +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.design.widget.BottomNavigationView; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentStatePagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.RelativeLayout; + +import nl.hnogames.domoticz.Interfaces.DomoticzFragmentListener; +import nl.hnogames.domoticz.MainActivity; +import nl.hnogames.domoticz.R; +import nl.hnogames.domoticz.Utils.SharedPrefUtil; +import nl.hnogames.domoticz.app.DomoticzCardFragment; +import nl.hnogames.domoticz.app.DomoticzDashboardFragment; +import nl.hnogames.domoticz.app.DomoticzRecyclerFragment; +import nl.hnogames.domoticz.app.RefreshFragment; + +public class MainPager extends RefreshFragment implements DomoticzFragmentListener { + private static final String TAG = MainPager.class.getSimpleName(); + private Context context; + private FragmentStatePagerAdapter adapterViewPager; + private BottomNavigationView bottomNavigation; + private ViewPager vpPager; + private SharedPrefUtil mSharedPrefs; + private RelativeLayout root; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public void RefreshFragment() { + Fragment f = (Fragment) vpPager + .getAdapter() + .instantiateItem(vpPager, vpPager.getCurrentItem()); + if (f instanceof DomoticzRecyclerFragment) { + ((DomoticzRecyclerFragment) f).refreshFragment(); + } else if (f instanceof DomoticzCardFragment) + ((DomoticzCardFragment) f).refreshFragment(); + else if (f instanceof DomoticzDashboardFragment) + ((DomoticzDashboardFragment) f).refreshFragment(); + else if (f instanceof RefreshFragment) + ((RefreshFragment) f).RefreshFragment(); + } + + @Override + public void Filter(String newText) { + Fragment n = (Fragment) vpPager + .getAdapter() + .instantiateItem(vpPager, vpPager.getCurrentItem()); + if (n instanceof DomoticzDashboardFragment) { + ((DomoticzDashboardFragment) n).Filter(newText); + } else if (n instanceof DomoticzRecyclerFragment) { + ((DomoticzRecyclerFragment) n).Filter(newText); + } else if (n instanceof RefreshFragment) { + ((RefreshFragment) n).Filter(newText); + } + } + + @Override + public void sortFragment(String selectedSort) { + Fragment f = (Fragment) vpPager + .getAdapter() + .instantiateItem(vpPager, vpPager.getCurrentItem()); + if (f instanceof DomoticzRecyclerFragment) { + ((DomoticzRecyclerFragment) f).sortFragment(selectedSort); + } else if (f instanceof DomoticzDashboardFragment) { + ((DomoticzDashboardFragment) f).sortFragment(selectedSort); + } else if (f instanceof RefreshFragment) { + ((RefreshFragment) f).sortFragment(selectedSort); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, + ViewGroup container, + Bundle savedInstanceState) { + if (mSharedPrefs == null) + mSharedPrefs = new SharedPrefUtil(getActivity()); + root = (RelativeLayout) inflater.inflate(R.layout.mainpager, null); + initViews(); + return root; + } + + @NonNull + private void initViews() { + vpPager = root.findViewById(R.id.vpPager); + bottomNavigation = root.findViewById(R.id.BottomNavigation); + if (mSharedPrefs.darkThemeEnabled()) { + bottomNavigation.setBackgroundColor(getResources().getColor(R.color.background_dark)); + } + adapterViewPager = new MainPagerAdapter(((AppCompatActivity) context), 5); + vpPager.setAdapter(adapterViewPager); + vpPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float v, int i1) { + } + + @Override + public void onPageSelected(int position) { + bottomNavigation.getMenu().getItem(position).setChecked(true); + SetTitle(GetTitle(position)); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).clearSearch(); + } + + @Override + public void onPageScrollStateChanged(int i) { + } + }); + + bottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.bbn_dashboard: + vpPager.setCurrentItem(0); + SetTitle(GetTitle(0)); + break; + case R.id.bbn_switches: + vpPager.setCurrentItem(1); + SetTitle(GetTitle(1)); + break; + case R.id.bbn_scenes: + vpPager.setCurrentItem(2); + SetTitle(GetTitle(2)); + break; + case R.id.bbn_temperature: + vpPager.setCurrentItem(3); + SetTitle(GetTitle(3)); + break; + case R.id.bbn_weather: + vpPager.setCurrentItem(4); + SetTitle(GetTitle(4)); + break; + } + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).clearSearch(); + return false; + } + }); + } + + public int GetTitle(int position) { + switch (position) { + case 0: + return R.string.title_dashboard; + case 1: + return R.string.title_switches; + case 2: + return R.string.title_scenes; + case 3: + return R.string.title_temperature; + case 4: + return R.string.title_weather; + default: + return R.string.title_dashboard; + } + } + + + @Override + public void onAttach(Context context) { + super.onAttach(context); + this.context = context; + SetTitle(R.string.title_dashboard); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + + private void SetTitle(int title) { + if (getActionBar() != null) + getActionBar().setTitle(title); + } + + public ActionBar getActionBar() { + return ((AppCompatActivity) context).getSupportActionBar(); + } + + @Override + public void onConnectionOk() { + Log.i(TAG, "Connection OK MainPager"); + } + + @Override + public void onConnectionFailed() { + Log.i(TAG, "Connection Failed MainPager"); + } + + public static class MainPagerAdapter extends FragmentStatePagerAdapter { + private final int mCount; + + public MainPagerAdapter(final AppCompatActivity activity, int count) { + super(activity.getSupportFragmentManager()); + this.mCount = count; + } + + // Returns total number of pages + @Override + public int getCount() { + return mCount; + } + + // Returns the fragment to display for that page + @Override + public Fragment getItem(int position) { + switch (position) { + case 0: + return new Dashboard(); + case 1: + return new Switches(); + case 2: + return new Scenes(); + case 3: + return new Temperature(); + case 4: + return new Weather(); + default: + return null; + } + } + + // Returns the page title for the top indicator + @Override + public CharSequence getPageTitle(int position) { + return "Page " + position; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Plans.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Plans.java index b50926783..a433717cc 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Plans.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Plans.java @@ -51,6 +51,7 @@ import nl.hnogames.domoticz.app.DomoticzCardFragment; import nl.hnogames.domoticzapi.Containers.PlanInfo; import nl.hnogames.domoticzapi.Interfaces.PlansReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Plans extends DomoticzCardFragment implements DomoticzFragmentListener { @@ -82,11 +83,6 @@ public void refreshFragment() { processPlans(); } - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - } - public void processPlans() { new GetCachedDataTask().execute(); } @@ -94,12 +90,19 @@ public void processPlans() { @Override public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; mSharedPrefs = new SharedPrefUtil(mContext); if (getActionBar() != null) getActionBar().setTitle(R.string.title_plans); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override public void errorHandling(Exception error, CoordinatorLayout coordinatorLayout) { if (error != null) { @@ -169,7 +172,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cachePlans = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cachePlans = (ArrayList) SerializableManager.readSerializedObject(mContext, "Plans"); Plans.this.mPlans = cachePlans; diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Scenes.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Scenes.java index bb8acf812..3a2881e6f 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Scenes.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Scenes.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.AsyncTask; +import android.os.Bundle; import android.os.Parcelable; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; @@ -54,6 +55,7 @@ import nl.hnogames.domoticzapi.Interfaces.ScenesReceiver; import nl.hnogames.domoticzapi.Interfaces.SwitchLogReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Scenes extends DomoticzRecyclerFragment implements DomoticzFragmentListener, ScenesClickListener { @@ -78,12 +80,19 @@ public void onConnectionFailed() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; - if (getActionBar() != null) - getActionBar().setTitle(R.string.title_scenes); initAnimation(); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + //if (getActionBar() != null) + // getActionBar().setTitle(R.string.title_scenes); + } + @Override @DebugLog public void Filter(String text) { @@ -401,7 +410,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheSwitches = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheSwitches = (ArrayList) SerializableManager.readSerializedObject(mContext, "Scenes"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Switches.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Switches.java index 06253aea8..d25411126 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Switches.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Switches.java @@ -22,8 +22,10 @@ package nl.hnogames.domoticz.Fragments; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Color; import android.os.AsyncTask; +import android.os.Bundle; import android.os.Parcelable; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; @@ -35,6 +37,9 @@ import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; +import com.skydoves.colorpickerview.ColorEnvelope; +import com.skydoves.colorpickerview.ColorPickerDialog; +import com.skydoves.colorpickerview.listeners.ColorEnvelopeListener; import java.util.ArrayList; import java.util.List; @@ -46,13 +51,13 @@ import nl.hnogames.domoticz.Interfaces.switchesClickListener; import nl.hnogames.domoticz.MainActivity; import nl.hnogames.domoticz.R; -import nl.hnogames.domoticz.UI.ColorPickerDialog; import nl.hnogames.domoticz.UI.NotificationInfoDialog; import nl.hnogames.domoticz.UI.PasswordDialog; import nl.hnogames.domoticz.UI.SecurityPanelDialog; import nl.hnogames.domoticz.UI.SwitchInfoDialog; import nl.hnogames.domoticz.UI.SwitchLogInfoDialog; import nl.hnogames.domoticz.UI.SwitchTimerInfoDialog; +import nl.hnogames.domoticz.UI.WWColorPickerDialog; import nl.hnogames.domoticz.Utils.SerializableManager; import nl.hnogames.domoticz.Utils.UsefulBits; import nl.hnogames.domoticz.Utils.WidgetUtils; @@ -68,6 +73,7 @@ import nl.hnogames.domoticzapi.Interfaces.SwitchLogReceiver; import nl.hnogames.domoticzapi.Interfaces.SwitchTimerReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Switches extends DomoticzRecyclerFragment implements DomoticzFragmentListener, switchesClickListener { @@ -101,13 +107,19 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; - - if (getActionBar() != null) - getActionBar().setTitle(R.string.title_switches); initAnimation(); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + //if (getActionBar() != null) + // getActionBar().setTitle(R.string.title_switches); + } + @Override @DebugLog public void Filter(String text) { @@ -142,13 +154,10 @@ private void getSwitchesData() { if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(true); WidgetUtils.RefreshWidgets(mContext); - new GetCachedDataTask().execute(); - } // add dynamic list view - // https://github.com/nhaarman/ListViewAnimations private void createListView(ArrayList switches) { if (getView() != null) { try { @@ -225,10 +234,15 @@ public void onRefresh() { private void showInfoDialog(final DevicesInfo mSwitch) { SwitchInfoDialog infoDialog = new SwitchInfoDialog( mContext, + mDomoticz, mSwitch, R.layout.dialog_switch_info); infoDialog.setIdx(String.valueOf(mSwitch.getIdx())); infoDialog.setLastUpdate(mSwitch.getLastUpdate()); + try { + infoDialog.setColorLight(mSwitch.getSubType().startsWith(DomoticzValues.Device.SubType.Name.RGB) || mSwitch.getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)); + } catch (Exception ex) { + } infoDialog.setSignalLevel(String.valueOf(mSwitch.getSignalLevel())); infoDialog.setBatteryLevel(String.valueOf(mSwitch.getBatteryLevel())); infoDialog.setIsFavorite(mSwitch.getFavoriteBoolean()); @@ -348,55 +362,123 @@ public void onLikeButtonClick(int idx, boolean checked) { @Override @DebugLog public void onColorButtonClick(final int idx) { - ColorPickerDialog colorDialog = new ColorPickerDialog( - mContext, idx); - colorDialog.show(); + if (getSwitch(idx).getSubType().startsWith(DomoticzValues.Device.SubType.Name.WW)) { + WWColorPickerDialog colorDialog = new WWColorPickerDialog(mContext, + getSwitch(idx).getIdx()); + colorDialog.show(); + colorDialog.onDismissListener(new WWColorPickerDialog.DismissListener() { + @Override + public void onDismiss(final int kelvin) { + if (getSwitch(idx).isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setKelvinColor(kelvin, idx, password, true); + } - colorDialog.onDismissListener(new ColorPickerDialog.DismissListener() { - @Override - @DebugLog - public void onDismiss(final int selectedColor) { - if (getSwitch(idx).isProtected()) { - PasswordDialog passwordDialog = new PasswordDialog( - mContext, mDomoticz); - passwordDialog.show(); - passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { - @Override - @DebugLog - public void onDismiss(String password) { - setColor(selectedColor, idx, password); - } + @Override + public void onCancel() { + } + }); + } else + setKelvinColor(kelvin, idx, null, true); + } - @Override - public void onCancel() { - } - }); - } else - setColor(selectedColor, idx, null); - } + @Override + public void onChangeColor(int kelvin) { + if (!getSwitch(idx).isProtected()) + setKelvinColor(kelvin, idx, null, false); + } + }); + } else { + ColorPickerDialog.Builder builder = new ColorPickerDialog.Builder(getContext()); + builder.setTitle(getString(R.string.choose_color)); + builder.setPositiveButton(getString(R.string.ok), new ColorEnvelopeListener() { + @Override + public void onColorSelected(final ColorEnvelope envelope, boolean fromUser) { + if (getSwitch(idx).isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setRGBColor(envelope.getColor(), idx, password, true); + } - @Override - @DebugLog - public void onChangeColor(final int selectedColor) { - if (!getSwitch(idx).isProtected()) { - setColor(selectedColor, idx, null); + @Override + public void onCancel() { + } + }); + } else + setRGBColor(envelope.getColor(), idx, null, true); } - } - }); + }); + builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + dialogInterface.dismiss(); + } + }); + builder.show(); // show dialog + } } - private void setColor(int selectedColor, final int idx, final String password) { + private void setKelvinColor(int kelvin, final int idx, final String password, final boolean selected) { + mDomoticz.setAction(idx, + DomoticzValues.Json.Url.Set.KELVIN, + DomoticzValues.Device.Dimmer.Action.KELVIN, + kelvin, + password, + new setCommandReceiver() { + @Override + @DebugLog + public void onReceiveResult(String result) { + if (selected) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getSwitch(idx).getName(), Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.color_set); + } + } + + @Override + @DebugLog + public void onError(Exception error) { + if (selected) { + if (!UsefulBits.isEmpty(password)) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); + } else { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.error_color); + } + } + } + }); + } + + private void setRGBColor(int selectedColor, final int idx, final String password, final boolean selected) { double[] hsv = UsefulBits.rgb2hsv(Color.red(selectedColor), Color.green(selectedColor), Color.blue(selectedColor)); - Log.v(TAG, "Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); - if (hsv.length <= 0) + if (hsv == null || hsv.length <= 0) return; + if (selected) { + Log.v(TAG, "Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); + addDebugText("Selected HVS Color: h:" + hsv[0] + " v:" + hsv[1] + " s:" + hsv[2] + " color: " + selectedColor); + } + boolean isWhite = false; long hue = Math.round(hsv[0]); if (selectedColor == -1) { isWhite = true; } - mDomoticz.setRGBColorAction(idx, DomoticzValues.Json.Url.Set.RGBCOLOR, hue, @@ -407,22 +489,26 @@ private void setColor(int selectedColor, final int idx, final String password) { @Override @DebugLog public void onReceiveResult(String result) { - UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getSwitch(idx).getName(), Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.color_set); + if (selected) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, mContext.getString(R.string.color_set) + ": " + getSwitch(idx).getName(), Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.color_set); + } } @Override @DebugLog public void onError(Exception error) { - if (!UsefulBits.isEmpty(password)) { - UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); - } else { - UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); - if (getActivity() instanceof MainActivity) - ((MainActivity) getActivity()).Talk(R.string.error_color); + if (selected) { + if (!UsefulBits.isEmpty(password)) { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.security_wrong_code, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.security_wrong_code); + } else { + UsefulBits.showSnackbar(mContext, coordinatorLayout, R.string.error_color, Snackbar.LENGTH_SHORT); + if (getActivity() instanceof MainActivity) + ((MainActivity) getActivity()).Talk(R.string.error_color); + } } } }); @@ -671,7 +757,8 @@ private void toggleSwitch(DevicesInfo clickedSwitch, boolean checked, final Stri int jsonAction; int jsonUrl = DomoticzValues.Json.Url.Set.SWITCHES; if (clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDS || - clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDPERCENTAGE) { + clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.BLINDPERCENTAGE || + clickedSwitch.getSwitchTypeVal() == DomoticzValues.Device.Type.Value.DOORLOCKINVERTED) { if (checked) jsonAction = DomoticzValues.Device.Switch.Action.OFF; else jsonAction = DomoticzValues.Device.Switch.Action.ON; } else { @@ -935,7 +1022,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheSwitches = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheSwitches = (ArrayList) SerializableManager.readSerializedObject(mContext, "Switches"); extendedStatusSwitches = cacheSwitches; diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Temperature.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Temperature.java index af39bf118..9b6322b29 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Temperature.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Temperature.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; @@ -53,6 +54,7 @@ import nl.hnogames.domoticzapi.DomoticzValues; import nl.hnogames.domoticzapi.Interfaces.TemperatureReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Temperature extends DomoticzRecyclerFragment implements DomoticzFragmentListener, TemperatureClickListener { @@ -80,7 +82,6 @@ public void onConnectionFailed() { public void refreshFragment() { if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(true); - processTemperature(); } @@ -88,12 +89,19 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; - if (getActionBar() != null) - getActionBar().setTitle(R.string.title_temperature); initAnimation(); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + //if (getActionBar() != null) + // getActionBar().setTitle(R.string.title_temperature); + } + @Override @DebugLog public void Filter(String text) { @@ -355,7 +363,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheTemperatures = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheTemperatures = (ArrayList) SerializableManager.readSerializedObject(mContext, "Temperatures"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/UserVariables.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/UserVariables.java index 92c2ca1d0..18b0dd1a8 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/UserVariables.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/UserVariables.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.AsyncTask; +import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.text.InputType; @@ -44,9 +45,9 @@ import nl.hnogames.domoticzapi.Containers.UserVariableInfo; import nl.hnogames.domoticzapi.Interfaces.UserVariablesReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class UserVariables extends DomoticzRecyclerFragment implements DomoticzFragmentListener, UserVariablesClickListener { - private ArrayList mUserVariableInfos; private UserVariablesAdapter adapter; private Context mContext; @@ -70,11 +71,18 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; if (getActionBar() != null) getActionBar().setTitle(R.string.title_vars); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override @DebugLog public void Filter(String text) { @@ -198,7 +206,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheUserVariables = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheUserVariables = (ArrayList) SerializableManager.readSerializedObject(mContext, "UserVariables"); UserVariables.this.mUserVariableInfos = cacheUserVariables; diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Utilities.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Utilities.java index 640b01c82..6e5ae73ba 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Utilities.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Utilities.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; @@ -57,6 +58,7 @@ import nl.hnogames.domoticzapi.Interfaces.SwitchLogReceiver; import nl.hnogames.domoticzapi.Interfaces.UtilitiesReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Utilities extends DomoticzRecyclerFragment implements DomoticzFragmentListener, UtilityClickListener { @@ -87,12 +89,19 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; if (getActionBar() != null) getActionBar().setTitle(R.string.title_utilities); initAnimation(); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + } + @Override @DebugLog public void Filter(String text) { @@ -459,7 +468,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheUtilities = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheUtilities = (ArrayList) SerializableManager.readSerializedObject(mContext, "Utilities"); Utilities.this.mUtilitiesInfos = cacheUtilities; diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Weather.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Weather.java index 155e54c3c..8e8654ad4 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Weather.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Weather.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; @@ -53,6 +54,7 @@ import nl.hnogames.domoticzapi.DomoticzValues; import nl.hnogames.domoticzapi.Interfaces.WeatherReceiver; import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; +import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil; public class Weather extends DomoticzRecyclerFragment implements DomoticzFragmentListener, WeatherClickListener { @@ -84,12 +86,19 @@ public void refreshFragment() { @DebugLog public void onAttach(Context context) { super.onAttach(context); + onAttachFragment(this); mContext = context; - if (getActionBar() != null) - getActionBar().setTitle(R.string.title_weather); initAnimation(); } + @Override + public void onActivityCreated(Bundle savedInstanceState) { + onAttachFragment(this); + super.onActivityCreated(savedInstanceState); + //if (getActionBar() != null) + // getActionBar().setTitle(R.string.title_weather); + } + @Override @DebugLog public void Filter(String text) { @@ -304,7 +313,9 @@ private class GetCachedDataTask extends AsyncTask { ArrayList cacheWeathers = null; protected Boolean doInBackground(Boolean... geto) { - if (!mPhoneConnectionUtil.isNetworkAvailable()) { + if (mPhoneConnectionUtil == null) + mPhoneConnectionUtil = new PhoneConnectionUtil(mContext); + if (mPhoneConnectionUtil != null && !mPhoneConnectionUtil.isNetworkAvailable()) { try { cacheWeathers = (ArrayList) SerializableManager.readSerializedObject(mContext, "Weathers"); } catch (Exception ex) { diff --git a/app/src/main/java/nl/hnogames/domoticz/MainActivity.java b/app/src/main/java/nl/hnogames/domoticz/MainActivity.java index f0c72a0f4..5acde416d 100644 --- a/app/src/main/java/nl/hnogames/domoticz/MainActivity.java +++ b/app/src/main/java/nl/hnogames/domoticz/MainActivity.java @@ -25,6 +25,7 @@ import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import android.os.StrictMode; import android.speech.RecognizerIntent; import android.speech.SpeechRecognizer; import android.support.annotation.NonNull; @@ -70,6 +71,7 @@ import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IProfile; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -82,7 +84,7 @@ import nl.hnogames.domoticz.Containers.QRCodeInfo; import nl.hnogames.domoticz.Containers.SpeechInfo; import nl.hnogames.domoticz.Fragments.Cameras; -import nl.hnogames.domoticz.Fragments.Dashboard; +import nl.hnogames.domoticz.Fragments.MainPager; import nl.hnogames.domoticz.Fragments.Scenes; import nl.hnogames.domoticz.Fragments.Switches; import nl.hnogames.domoticz.UI.PasswordDialog; @@ -101,6 +103,7 @@ import nl.hnogames.domoticz.app.DomoticzCardFragment; import nl.hnogames.domoticz.app.DomoticzDashboardFragment; import nl.hnogames.domoticz.app.DomoticzRecyclerFragment; +import nl.hnogames.domoticz.app.RefreshFragment; import nl.hnogames.domoticzapi.Containers.ConfigInfo; import nl.hnogames.domoticzapi.Containers.DevicesInfo; import nl.hnogames.domoticzapi.Containers.ServerInfo; @@ -155,6 +158,15 @@ public ServerUtil getServerUtil() { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (Build.VERSION.SDK_INT >= 24) { + try { + Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure"); + m.invoke(null); + } catch (Exception e) { + e.printStackTrace(); + } + } + mSharedPrefs = new SharedPrefUtil(this); if (mSharedPrefs.darkThemeEnabled()) setTheme(R.style.AppThemeDarkMain); @@ -163,17 +175,14 @@ protected void onCreate(Bundle savedInstanceState) { permissionHelper = PermissionHelper.getInstance(this); UsefulBits.checkAPK(this, mSharedPrefs); - AdView mAdView; if (BuildConfig.LITE_VERSION || !mSharedPrefs.isAPKValidated()) { setContentView(R.layout.activity_newmain_free); - mAdView = findViewById(R.id.adView); MobileAds.initialize(this, this.getString(R.string.ADMOB_APP_KEY)); - AdRequest adRequest = new AdRequest.Builder().addTestDevice("83DBECBB403C3E924CAA8B529F7E848E").build(); - mAdView.loadAd(adRequest); + AdRequest adRequest = new AdRequest.Builder().addTestDevice("A18F9718FC3511DC6BCB1DC5AF076AE4").build(); + ((AdView) findViewById(R.id.adView)).loadAd(adRequest); } else { setContentView(R.layout.activity_newmain_paid); - mAdView = findViewById(R.id.adView); - mAdView.setVisibility(View.GONE); + (findViewById(R.id.adView)).setVisibility(View.GONE); } if (savedInstanceState == null) { @@ -185,6 +194,9 @@ protected void onCreate(Bundle savedInstanceState) { } toolbar = findViewById(R.id.toolbar); + if (mSharedPrefs.darkThemeEnabled()) + toolbar.setBackgroundColor(getResources().getColor(R.color.secondary)); + setSupportActionBar(toolbar); boolean resolvableError = UsefulBits.checkPlayServicesAvailable(this); @@ -505,7 +517,6 @@ private int getSelectorValue(DevicesInfo mDevicesInfo, String value) { return jsonValue; } - @DebugLog public void refreshFragment() { Fragment f = latestFragment; @@ -515,6 +526,8 @@ public void refreshFragment() { ((DomoticzCardFragment) f).refreshFragment(); else if (f instanceof DomoticzDashboardFragment) ((DomoticzDashboardFragment) f).refreshFragment(); + else if (f instanceof RefreshFragment) + ((RefreshFragment) f).RefreshFragment(); } @DebugLog @@ -832,11 +845,19 @@ private List getDrawerItems() { String ICONS[] = mSharedPrefs.getNavigationIcons(); for (int i = 0; i < drawerActions.length; i++) - if (fragments[i].contains("Wizard") || fragments[i].contains("Dashboard")) + if (fragments[i].contains("Wizard") || fragments[i].contains("MainPager")) + drawerItems.add(createPrimaryDrawerItem(drawerActions[i], ICONS[i], fragments[i])); + + drawerItems.add(new DividerDrawerItem()); + + for (int i = 0; i < drawerActions.length; i++) + if ((!fragments[i].contains("Wizard") && !fragments[i].contains("MainPager")) && fragments[i].contains("Utilities") || fragments[i].contains("Plans") || fragments[i].contains("Camera")) drawerItems.add(createPrimaryDrawerItem(drawerActions[i], ICONS[i], fragments[i])); + drawerItems.add(new DividerDrawerItem()); + for (int i = 0; i < drawerActions.length; i++) - if (!fragments[i].contains("Wizard") && !fragments[i].contains("Dashboard")) + if (!fragments[i].contains("Wizard") && !fragments[i].contains("MainPager") && !fragments[i].contains("Utilities") && !fragments[i].contains("Plans") && !fragments[i].contains("Camera")) drawerItems.add(createSecondaryDrawerItem(drawerActions[i], ICONS[i], fragments[i])); return drawerItems; @@ -851,7 +872,6 @@ private SecondaryDrawerItem createSecondaryDrawerItem(String title, String icon, item.withIconColorRes(R.color.white); item.withSelectedColorRes(R.color.material_indigo_600); } - return item; } @@ -864,7 +884,6 @@ private PrimaryDrawerItem createPrimaryDrawerItem(String title, String icon, Str item.withIconColorRes(R.color.white); item.withSelectedColorRes(R.color.material_indigo_600); } - return item; } @@ -981,8 +1000,8 @@ public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_camera_pause, menu); else getMenuInflater().inflate(R.menu.menu_camera, menu); - } else if ((f instanceof DomoticzDashboardFragment) || (f instanceof DomoticzRecyclerFragment)) { - if ((f instanceof Dashboard) || (f instanceof Scenes) || (f instanceof Switches)) + } else if ((f instanceof DomoticzDashboardFragment) || (f instanceof DomoticzRecyclerFragment) || (f instanceof RefreshFragment)) { + if ((f instanceof MainPager) || (f instanceof Scenes) || (f instanceof Switches)) getMenuInflater().inflate(R.menu.menu_main_sort, menu); else getMenuInflater().inflate(R.menu.menu_main, menu); @@ -1004,6 +1023,8 @@ public boolean onQueryTextChange(String newText) { ((DomoticzDashboardFragment) n).Filter(newText); } else if (n instanceof DomoticzRecyclerFragment) { ((DomoticzRecyclerFragment) n).Filter(newText); + } else if (n instanceof RefreshFragment) { + ((RefreshFragment) n).Filter(newText); } return false; } @@ -1164,6 +1185,8 @@ public void onDismiss(String selectedSort) { ((DomoticzRecyclerFragment) f).sortFragment(selectedSort); } else if (f instanceof DomoticzDashboardFragment) { ((DomoticzDashboardFragment) f).sortFragment(selectedSort); + } else if (f instanceof RefreshFragment) { + ((RefreshFragment) f).sortFragment(selectedSort); } } }); @@ -1398,6 +1421,15 @@ public void onDestroy() { super.onDestroy(); } + @DebugLog + public void clearSearch() { + if (searchViewAction != null) { + searchViewAction.setQuery("", false); + searchViewAction.clearFocus(); + searchViewAction.onActionViewCollapsed(); + } + } + @Override @DebugLog public void onPause() { @@ -1473,16 +1505,19 @@ public void onDigitusError(Digitus digitus, DigitusErrorType type, Exception e) @Override public void onFingerprintDialogAuthenticated() { - FingerprintDialog dialog = FingerprintDialog.getVisible(this); - if (dialog != null) - dialog.dismiss(); - Digitus.deinit(); - validateOnce = false; - if (!mSharedPrefs.isGeofencingStarted()) { - mSharedPrefs.setGeofencingStarted(true); - new GeoUtils(this, this).AddGeofences(); + try { + FingerprintDialog dialog = FingerprintDialog.getVisible(this); + if (dialog != null) + dialog.dismiss(); + Digitus.deinit(); + validateOnce = false; + if (!mSharedPrefs.isGeofencingStarted()) { + mSharedPrefs.setGeofencingStarted(true); + new GeoUtils(this, this).AddGeofences(); + } + buildScreen(); + } catch (Exception ex) { } - buildScreen(); } @Override diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/ColorPickerDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/ColorPickerDialog.java deleted file mode 100644 index b38baf60e..000000000 --- a/app/src/main/java/nl/hnogames/domoticz/UI/ColorPickerDialog.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2015 Domoticz - Mark Heinis - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package nl.hnogames.domoticz.UI; - -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.support.annotation.ColorInt; -import android.view.View; - -import com.afollestad.materialdialogs.MaterialDialog; -import com.afollestad.materialdialogs.Theme; -import com.larswerkman.lobsterpicker.LobsterPicker; -import com.larswerkman.lobsterpicker.OnColorListener; -import com.larswerkman.lobsterpicker.sliders.LobsterShadeSlider; - -import nl.hnogames.domoticz.R; -import nl.hnogames.domoticz.Utils.SharedPrefUtil; - -public class ColorPickerDialog implements DialogInterface.OnDismissListener { - - private final MaterialDialog.Builder mdb; - private DismissListener dismissListener; - private Context mContext; - private LobsterPicker lobsterPicker; - private LobsterShadeSlider shadeSlider; - private SharedPrefUtil mSharedPrefs; - private int idx; - - public ColorPickerDialog(Context mContext, int idx) { - this.mContext = mContext; - mSharedPrefs = new SharedPrefUtil(mContext); - this.idx = idx; - - if (mSharedPrefs.darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); - mdb.customView(R.layout.dialog_color, true) - .theme(mSharedPrefs.darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) - .positiveText(android.R.string.ok); - - mdb.dismissListener(this); - } - - public void show() { - mdb.title(mContext.getString(R.string.choose_color)); - final MaterialDialog md = mdb.build(); - View view = md.getCustomView(); - - if (view != null) { - lobsterPicker = (LobsterPicker) view.findViewById(R.id.lobsterpicker); - shadeSlider = (LobsterShadeSlider) view.findViewById(R.id.shadeslider); - lobsterPicker.addDecorator(shadeSlider); - lobsterPicker.setColorHistoryEnabled(true); - lobsterPicker.setHistory(mSharedPrefs.getPreviousColor(idx)); - lobsterPicker.setColorPosition(mSharedPrefs.getPreviousColorPosition(idx)); - - shadeSlider.addOnColorListener(new OnColorListener() { - @Override - public void onColorChanged(@ColorInt int color) { - } - - @Override - public void onColorSelected(@ColorInt int color) { - mSharedPrefs.savePreviousColor(idx, color, lobsterPicker.getColorPosition()); - dismissListener.onChangeColor(color); - } - }); - - lobsterPicker.addOnColorListener(new OnColorListener() { - @Override - public void onColorChanged(@ColorInt int color) { - } - - @Override - public void onColorSelected(@ColorInt int color) { - mSharedPrefs.savePreviousColor(idx, color, lobsterPicker.getColorPosition()); - dismissListener.onChangeColor(color); - } - }); - } - - md.show(); - } - - @Override - public void onDismiss(DialogInterface dialogInterface) { - if (dismissListener != null) - dismissListener.onDismiss(shadeSlider.getColor()); - } - - public void onDismissListener(DismissListener dismissListener) { - this.dismissListener = dismissListener; - } - - public interface DismissListener { - void onDismiss(int color); - - void onChangeColor(int color); - } -} \ No newline at end of file diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/DeviceInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/DeviceInfoDialog.java index 6dae1b003..618275843 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/DeviceInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/DeviceInfoDialog.java @@ -23,24 +23,27 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; +import android.support.design.button.MaterialButton; import android.view.MotionEvent; import android.view.View; -import android.widget.CompoundButton; +import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.Switch; import android.widget.TextView; +import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.Theme; +import hugo.weaving.DebugLog; import nl.hnogames.domoticz.R; import nl.hnogames.domoticz.Utils.SharedPrefUtil; import nl.hnogames.domoticzapi.Containers.DevicesInfo; import nl.hnogames.domoticzapi.Domoticz; +import nl.hnogames.domoticzapi.DomoticzValues; +import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; public class DeviceInfoDialog implements DialogInterface.OnDismissListener { - private final MaterialDialog.Builder mdb; private DismissListener dismissListener; private DevicesInfo mSwitch; @@ -49,30 +52,25 @@ public class DeviceInfoDialog implements DialogInterface.OnDismissListener { private String signalLevel; private String batteryLevel; private boolean isFavorite; + private boolean isColorLight; private Context mContext; private SharedPrefUtil mSharedPrefs; private Switch favorite_switch; + private LinearLayout colorOptions; + private Domoticz mDomoticz; + private MaterialButton buttonNight, buttonFull; + private boolean isChanged = false; public DeviceInfoDialog(Context mContext, + Domoticz domoticz, DevicesInfo mSwitch, int layout) { this.mContext = mContext; this.mSwitch = mSwitch; + this.mDomoticz = domoticz; this.mSharedPrefs = new SharedPrefUtil(mContext); - if (mSharedPrefs.darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) @@ -85,6 +83,10 @@ public void setIdx(String idx) { this.idx = idx; } + public void setColorLight(boolean iscolorLight) { + this.isColorLight = iscolorLight; + } + public void setLastUpdate(String lastUpdate) { this.lastUpdate = lastUpdate; } @@ -102,16 +104,20 @@ public void setIsFavorite(boolean isFavorite) { } public void show() { - mdb.title(mSwitch.getName()); MaterialDialog md = mdb.build(); View view = md.getCustomView(); - TextView IDX_value = (TextView) view.findViewById(R.id.IDX_value); + TextView IDX_value = view.findViewById(R.id.IDX_value); IDX_value.setText(idx); - TextView LastUpdate_value = (TextView) view.findViewById(R.id.LastUpdate_value); + InitButtons(view); + + TextView LastUpdate_value = view.findViewById(R.id.LastUpdate_value); + colorOptions = view.findViewById(R.id.color_light_options); + if (isColorLight) + colorOptions.setVisibility(View.VISIBLE); LastUpdate_value.setText(lastUpdate); int signalLevelVal; @@ -122,7 +128,7 @@ public void show() { signalLevelVal = 0; } - SeekBar signalLevelIndicator = (SeekBar) view.findViewById(R.id.SignalLevel_indicator); + SeekBar signalLevelIndicator = view.findViewById(R.id.SignalLevel_indicator); signalLevelIndicator.setVisibility(View.VISIBLE); signalLevelIndicator.setOnTouchListener(new View.OnTouchListener() { @Override @@ -137,7 +143,7 @@ public boolean onTouch(View v, MotionEvent event) { signalLevelIndicator.startAnimation(anim); - TextView BatteryLevel_value = (TextView) view.findViewById(R.id.BatteryLevel_value); + TextView BatteryLevel_value = view.findViewById(R.id.BatteryLevel_value); int batteryLevelVal; try { batteryLevelVal = Integer.valueOf(batteryLevel); @@ -150,7 +156,7 @@ public boolean onTouch(View v, MotionEvent event) { BatteryLevel_value.setText(batteryLevel); } else { BatteryLevel_value.setVisibility(View.GONE); - SeekBar batteryLevelIndicator = (SeekBar) view.findViewById(R.id.BatteryLevel_indicator); + SeekBar batteryLevelIndicator = view.findViewById(R.id.BatteryLevel_indicator); batteryLevelIndicator.setVisibility(View.VISIBLE); batteryLevelIndicator.setOnTouchListener(new View.OnTouchListener() { @Override @@ -164,22 +170,83 @@ public boolean onTouch(View v, MotionEvent event) { batteryLevelIndicator.startAnimation(anim); } - - favorite_switch = (Switch) view.findViewById(R.id.favorite_switch); + favorite_switch = view.findViewById(R.id.favorite_switch); favorite_switch.setChecked(isFavorite); - favorite_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + md.show(); + } + + private void InitButtons(View view) { + buttonNight = view.findViewById(R.id.night_button); + buttonFull = view.findViewById(R.id.full_button); + + buttonNight.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mSwitch.isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setAction(DomoticzValues.Json.Url.Set.NIGHTLIGHT, DomoticzValues.Device.Switch.Action.ON, password); + Toast.makeText(mContext, mContext.getString(R.string.switch_night) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT).show(); + } + + @Override + public void onCancel() { + } + }); + } else { + setAction(DomoticzValues.Json.Url.Set.NIGHTLIGHT, DomoticzValues.Device.Switch.Action.ON, null); + Toast.makeText(mContext, mContext.getString(R.string.switch_night) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT).show(); + } + } + }); + buttonFull.setOnClickListener(new View.OnClickListener() { @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { + public void onClick(View v) { + if (mSwitch.isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setAction(DomoticzValues.Json.Url.Set.FULLLIGHT, DomoticzValues.Device.Switch.Action.ON, password); + Toast.makeText(mContext, mContext.getString(R.string.switch_full) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT).show(); + } + @Override + public void onCancel() { + } + }); + } else { + setAction(DomoticzValues.Json.Url.Set.FULLLIGHT, DomoticzValues.Device.Switch.Action.ON, null); + Toast.makeText(mContext, mContext.getString(R.string.switch_full) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT).show(); + } } }); + } - md.show(); + public void setAction(int jsonUrl, int actionUrl, final String password) { + isChanged = true; + mDomoticz.setAction(mSwitch.getIdx(), jsonUrl, actionUrl, 0, password, new setCommandReceiver() { + @Override + @DebugLog + public void onReceiveResult(String result) { + } + + @Override + public void onError(Exception error) { + } + }); } @Override public void onDismiss(DialogInterface dialogInterface) { - boolean isChanged = false; boolean isChecked = favorite_switch.isChecked(); if (isChecked != isFavorite) isChanged = true; if (dismissListener != null) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/FingerprintPasswordDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/FingerprintPasswordDialog.java index 2639b1fda..d71cf3d8e 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/FingerprintPasswordDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/FingerprintPasswordDialog.java @@ -57,19 +57,8 @@ public FingerprintPasswordDialog(Context c, Domoticz mDomoticz) { this.mContext = c; this.domoticz = mDomoticz; mSharedPrefs = new SharedPrefUtil(c); - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + + mdb = new MaterialDialog.Builder(mContext); mdb.customView(R.layout.dialog_password, true) .positiveText(android.R.string.ok) .negativeText(android.R.string.cancel) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/NotificationInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/NotificationInfoDialog.java index affbd5529..b0e3a2f7e 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/NotificationInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/NotificationInfoDialog.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.UI; import android.content.Context; -import android.graphics.Color; import android.view.View; import android.widget.ListView; @@ -47,19 +46,7 @@ public NotificationInfoDialog(Context c, this.info = _info; this.mContext = c; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(R.layout.dialog_switch_timer, true) .theme((new SharedPrefUtil(mContext)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .positiveText(android.R.string.ok); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/PasswordDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/PasswordDialog.java index f0de84392..de43e861a 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/PasswordDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/PasswordDialog.java @@ -57,19 +57,7 @@ public PasswordDialog(Context c, Domoticz mDomoticz) { this.mContext = c; this.domoticz = mDomoticz; mSharedPrefs = new SharedPrefUtil(c); - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(R.layout.dialog_password, true) .positiveText(android.R.string.ok) .negativeText(android.R.string.cancel) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SceneInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SceneInfoDialog.java index 8badb24b0..e092dcdc8 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SceneInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SceneInfoDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.CompoundButton; import android.widget.Switch; @@ -50,19 +49,7 @@ public SceneInfoDialog(Context mContext, SceneInfo info, int layout) { this.info = info; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SecurityPanelDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SecurityPanelDialog.java index 205a19731..9a34046cb 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SecurityPanelDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SecurityPanelDialog.java @@ -72,20 +72,7 @@ public SecurityPanelDialog(Context c, Domoticz mDomoticz, DevicesInfo panelInfo) this.domoticz = mDomoticz; this.panelInfo = panelInfo; mSharedPrefs = new SharedPrefUtil(c); - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); - + mdb = new MaterialDialog.Builder(mContext); mdb.customView(R.layout.dialog_security, true) .theme(mSharedPrefs.darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .negativeText(android.R.string.cancel); @@ -112,9 +99,9 @@ public void show() { txtCountDown = (TextView) view.findViewById(R.id.countdown); if (mSharedPrefs.darkThemeEnabled()) { - btnDisarm.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); - btnArmHome.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); - btnArmAway.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); + btnDisarm.setBackground(ContextCompat.getDrawable(mContext, R.color.button_dark)); + btnArmHome.setBackground(ContextCompat.getDrawable(mContext, R.color.button_dark)); + btnArmAway.setBackground(ContextCompat.getDrawable(mContext, R.color.button_dark)); editPinCode.setTextColor(ContextCompat.getColor(mContext, R.color.white)); int[][] states = new int[][]{new int[]{android.R.attr.state_activated}, new int[]{-android.R.attr.state_activated}}; diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SimpleTextDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SimpleTextDialog.java index 6a258f114..f67e8207f 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SimpleTextDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SimpleTextDialog.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.UI; import android.content.Context; -import android.graphics.Color; import android.view.View; import android.widget.TextView; @@ -44,19 +43,7 @@ public SimpleTextDialog(Context mContext) { this.mContext = mContext; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SortDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SortDialog.java index 60fc36998..68fd4b999 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SortDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SortDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -32,7 +31,6 @@ import com.afollestad.materialdialogs.MaterialDialog; import nl.hnogames.domoticz.R; -import nl.hnogames.domoticz.Utils.SharedPrefUtil; public class SortDialog implements DialogInterface.OnDismissListener { @@ -46,19 +44,7 @@ public SortDialog(Context c, this.mContext = c; names = new String[]{mContext.getString(R.string.filterOn_on), mContext.getString(R.string.filterOn_off), mContext.getString(R.string.filterOn_static), mContext.getString(R.string.filterOn_all)}; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(layout, true) .negativeText(android.R.string.cancel); mdb.dismissListener(this); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchDialog.java index 8831c7223..818024100 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -55,19 +54,7 @@ public SwitchDialog(Context c, this.mContext = c; this.mDomoticz = domoticz; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(layout, true) .theme((new SharedPrefUtil(mContext)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .negativeText(android.R.string.cancel); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchInfoDialog.java index d508196b8..527fa5604 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchInfoDialog.java @@ -23,21 +23,26 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; +import android.support.design.button.MaterialButton; import android.view.MotionEvent; import android.view.View; import android.widget.CompoundButton; +import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.Switch; import android.widget.TextView; +import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.Theme; +import hugo.weaving.DebugLog; import nl.hnogames.domoticz.R; import nl.hnogames.domoticz.Utils.SharedPrefUtil; import nl.hnogames.domoticzapi.Containers.DevicesInfo; import nl.hnogames.domoticzapi.Domoticz; +import nl.hnogames.domoticzapi.DomoticzValues; +import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver; public class SwitchInfoDialog implements DialogInterface.OnDismissListener { @@ -51,28 +56,22 @@ public class SwitchInfoDialog implements DialogInterface.OnDismissListener { private boolean isFavorite; private Context mContext; private Switch favorite_switch; + private boolean isColorLight; + private LinearLayout colorOptions; + private Domoticz mDomoticz; + private MaterialButton buttonNight, buttonFull; + private boolean isChanged = false; public SwitchInfoDialog(Context mContext, + Domoticz domoticz, DevicesInfo mSwitch, int layout) { this.mContext = mContext; this.mSwitch = mSwitch; + this.mDomoticz = domoticz; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; - //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) .theme((new SharedPrefUtil(mContext)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .positiveText(android.R.string.ok); @@ -83,6 +82,10 @@ public void setIdx(String idx) { this.idx = idx; } + public void setColorLight(boolean iscolorLight) { + this.isColorLight = iscolorLight; + } + public void setLastUpdate(String lastUpdate) { this.lastUpdate = lastUpdate; } @@ -106,12 +109,18 @@ public void show() { MaterialDialog md = mdb.build(); View view = md.getCustomView(); - TextView IDX_value = (TextView) view.findViewById(R.id.IDX_value); + TextView IDX_value = view.findViewById(R.id.IDX_value); IDX_value.setText(idx); - TextView LastUpdate_value = (TextView) view.findViewById(R.id.LastUpdate_value); + InitButtons(view); + + TextView LastUpdate_value = view.findViewById(R.id.LastUpdate_value); LastUpdate_value.setText(lastUpdate); + colorOptions = view.findViewById(R.id.color_light_options); + if (isColorLight) + colorOptions.setVisibility(View.VISIBLE); + int signalLevelVal; try { signalLevelVal = Integer.valueOf(signalLevel); @@ -120,7 +129,7 @@ public void show() { signalLevelVal = 0; } - SeekBar signalLevelIndicator = (SeekBar) view.findViewById(R.id.SignalLevel_indicator); + SeekBar signalLevelIndicator = view.findViewById(R.id.SignalLevel_indicator); signalLevelIndicator.setVisibility(View.VISIBLE); signalLevelIndicator.setOnTouchListener(new View.OnTouchListener() { @Override @@ -134,8 +143,7 @@ public boolean onTouch(View v, MotionEvent event) { anim.setDuration(1000); signalLevelIndicator.startAnimation(anim); - - TextView BatteryLevel_value = (TextView) view.findViewById(R.id.BatteryLevel_value); + TextView BatteryLevel_value = view.findViewById(R.id.BatteryLevel_value); int batteryLevelVal; try { batteryLevelVal = Integer.valueOf(batteryLevel); @@ -148,7 +156,7 @@ public boolean onTouch(View v, MotionEvent event) { BatteryLevel_value.setText(batteryLevel); } else { BatteryLevel_value.setVisibility(View.GONE); - SeekBar batteryLevelIndicator = (SeekBar) view.findViewById(R.id.BatteryLevel_indicator); + SeekBar batteryLevelIndicator = view.findViewById(R.id.BatteryLevel_indicator); batteryLevelIndicator.setVisibility(View.VISIBLE); batteryLevelIndicator.setOnTouchListener(new View.OnTouchListener() { @Override @@ -162,8 +170,7 @@ public boolean onTouch(View v, MotionEvent event) { batteryLevelIndicator.startAnimation(anim); } - - favorite_switch = (Switch) view.findViewById(R.id.favorite_switch); + favorite_switch = view.findViewById(R.id.favorite_switch); favorite_switch.setChecked(isFavorite); favorite_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -171,13 +178,80 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { } }); - md.show(); } + private void InitButtons(View view) { + buttonNight = view.findViewById(R.id.night_button); + buttonFull = view.findViewById(R.id.full_button); + buttonNight.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mSwitch.isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setAction(DomoticzValues.Json.Url.Set.NIGHTLIGHT, DomoticzValues.Device.Switch.Action.ON, password); + Toast.makeText(mContext, mContext.getString(R.string.switch_night) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT); + } + + @Override + public void onCancel() { + } + }); + } else { + setAction(DomoticzValues.Json.Url.Set.NIGHTLIGHT, DomoticzValues.Device.Switch.Action.ON, null); + Toast.makeText(mContext, mContext.getString(R.string.switch_night) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT); + } + } + }); + buttonFull.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mSwitch.isProtected()) { + PasswordDialog passwordDialog = new PasswordDialog( + mContext, mDomoticz); + passwordDialog.show(); + passwordDialog.onDismissListener(new PasswordDialog.DismissListener() { + @Override + @DebugLog + public void onDismiss(String password) { + setAction(DomoticzValues.Json.Url.Set.FULLLIGHT, DomoticzValues.Device.Switch.Action.ON, password); + Toast.makeText(mContext, mContext.getString(R.string.switch_full) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT); + } + + @Override + public void onCancel() { + } + }); + } else { + setAction(DomoticzValues.Json.Url.Set.FULLLIGHT, DomoticzValues.Device.Switch.Action.ON, null); + Toast.makeText(mContext, mContext.getString(R.string.switch_full) + ": " + mSwitch.getName(), Toast.LENGTH_SHORT); + } + } + }); + } + + public void setAction(int jsonUrl, int actionUrl, final String password) { + isChanged = true; + mDomoticz.setAction(mSwitch.getIdx(), jsonUrl, actionUrl, 0, password, new setCommandReceiver() { + @Override + @DebugLog + public void onReceiveResult(String result) { + } + + @Override + public void onError(Exception error) { + } + }); + } + @Override public void onDismiss(DialogInterface dialogInterface) { - boolean isChanged = false; boolean isChecked = favorite_switch.isChecked(); if (isChecked != isFavorite) isChanged = true; if (dismissListener != null) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchLogInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchLogInfoDialog.java index 981547519..f35c061b7 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchLogInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchLogInfoDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; @@ -48,19 +47,7 @@ public SwitchLogInfoDialog(Context c, int layout) { this.info = _info; this.mContext = c; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(layout, true) .theme((new SharedPrefUtil(mContext)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .positiveText(android.R.string.ok); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchTimerInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchTimerInfoDialog.java index 3467d2382..b16067741 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/SwitchTimerInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/SwitchTimerInfoDialog.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.UI; import android.content.Context; -import android.graphics.Color; import android.view.View; import android.widget.ListView; @@ -48,19 +47,7 @@ public SwitchTimerInfoDialog(Context c, this.info = _info; this.mContext = c; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(layout, true) .theme((new SharedPrefUtil(mContext)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) .positiveText(android.R.string.ok); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureDialog.java index b550aff51..f4704a352 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureDialog.java @@ -22,7 +22,6 @@ package nl.hnogames.domoticz.UI; import android.content.Context; -import android.graphics.Color; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.view.View; @@ -61,19 +60,7 @@ public TemperatureDialog(Context mContext, double temp) { if (mSharedPrefUtil == null) mSharedPrefUtil = new SharedPrefUtil(mContext); - if (mSharedPrefUtil.darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); mdb.customView(R.layout.dialog_temperature, false) .negativeText(android.R.string.cancel) .theme(mSharedPrefUtil.darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) @@ -107,8 +94,8 @@ public void show() { Button btnMin = (Button) view.findViewById(R.id.min); if (mSharedPrefUtil.darkThemeEnabled()) { - bntPlus.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); - btnMin.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); + bntPlus.setBackground(ContextCompat.getDrawable(mContext, R.color.button_dark)); + btnMin.setBackground(ContextCompat.getDrawable(mContext, R.color.button_dark)); } final String text = String.valueOf(currentTemperature); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureInfoDialog.java index 4d1dd5a41..5b7f4693d 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/TemperatureInfoDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.CompoundButton; import android.widget.Switch; @@ -50,19 +49,8 @@ public TemperatureInfoDialog(Context mContext, TemperatureInfo info, int layout) { this.info = info; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/TextDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/TextDialog.java index 4467b7eea..856bfb2cc 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/TextDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/TextDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.TextView; @@ -53,19 +52,7 @@ public TextDialog(Context context) { this.context = context; - if ((new SharedPrefUtil(context)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(context) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(context); + mdb = new MaterialDialog.Builder(context); mdb.customView(R.layout.dialog_text, true).negativeText(android.R.string.cancel) .theme((new SharedPrefUtil(context)).darkThemeEnabled() ? Theme.DARK : Theme.LIGHT); mdb.dismissListener(this); diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/UtilitiesInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/UtilitiesInfoDialog.java index 67ad12d03..b16602761 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/UtilitiesInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/UtilitiesInfoDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.CompoundButton; import android.widget.Switch; @@ -50,19 +49,7 @@ public UtilitiesInfoDialog(Context mContext, UtilitiesInfo info, int layout) { this.info = info; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/WWColorPickerDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/WWColorPickerDialog.java new file mode 100644 index 000000000..26ce23a97 --- /dev/null +++ b/app/src/main/java/nl/hnogames/domoticz/UI/WWColorPickerDialog.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2015 Domoticz - Mark Heinis + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package nl.hnogames.domoticz.UI; + +import android.content.Context; +import android.content.DialogInterface; +import android.view.View; +import android.widget.SeekBar; + +import com.afollestad.materialdialogs.MaterialDialog; +import com.afollestad.materialdialogs.Theme; + +import nl.hnogames.domoticz.R; +import nl.hnogames.domoticz.Utils.SharedPrefUtil; + +public class WWColorPickerDialog implements DialogInterface.OnDismissListener { + private final MaterialDialog.Builder mdb; + private DismissListener dismissListener; + private Context mContext; + private SharedPrefUtil mSharedPrefs; + private int idx; + private SeekBar kelvinBar; + + public WWColorPickerDialog(Context mContext, int idx) { + this.mContext = mContext; + mSharedPrefs = new SharedPrefUtil(mContext); + this.idx = idx; + mdb = new MaterialDialog.Builder(mContext); + mdb.customView(R.layout.dialog_wwcolor, true) + .theme(mSharedPrefs.darkThemeEnabled() ? Theme.DARK : Theme.LIGHT) + .positiveText(android.R.string.ok); + mdb.dismissListener(this); + } + + public void show() { + mdb.title(mContext.getString(R.string.choose_color)); + final MaterialDialog md = mdb.build(); + View view = md.getCustomView(); + + if (view != null) { + kelvinBar = view.findViewById(R.id.kelvinBar); + kelvinBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (dismissListener != null) + dismissListener.onChangeColor(kelvinBar.getProgress()); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + } + + md.show(); + } + + @Override + public void onDismiss(DialogInterface dialogInterface) { + if (dismissListener != null) + dismissListener.onDismiss(kelvinBar.getProgress()); + } + + public void onDismissListener(DismissListener dismissListener) { + this.dismissListener = dismissListener; + } + + public interface DismissListener { + void onDismiss(int color); + + void onChangeColor(int color); + } +} \ No newline at end of file diff --git a/app/src/main/java/nl/hnogames/domoticz/UI/WeatherInfoDialog.java b/app/src/main/java/nl/hnogames/domoticz/UI/WeatherInfoDialog.java index da9750704..39104a4ee 100644 --- a/app/src/main/java/nl/hnogames/domoticz/UI/WeatherInfoDialog.java +++ b/app/src/main/java/nl/hnogames/domoticz/UI/WeatherInfoDialog.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.DialogInterface; -import android.graphics.Color; import android.view.View; import android.widget.CompoundButton; import android.widget.Switch; @@ -48,19 +47,7 @@ public WeatherInfoDialog(Context mContext, WeatherInfo info, int layout) { this.info = info; - if ((new SharedPrefUtil(mContext)).darkThemeEnabled()) { - mdb = new MaterialDialog.Builder(mContext) - .titleColorRes(R.color.white) - .contentColor(Color.WHITE) // notice no 'res' postfix for literal color - .dividerColorRes(R.color.white) - .backgroundColorRes(R.color.primary) - .positiveColorRes(R.color.white) - .neutralColorRes(R.color.white) - .negativeColorRes(R.color.white) - .widgetColorRes(R.color.white) - .buttonRippleColorRes(R.color.white); - } else - mdb = new MaterialDialog.Builder(mContext); + mdb = new MaterialDialog.Builder(mContext); boolean wrapInScrollView = true; //noinspection ConstantConditions mdb.customView(layout, wrapInScrollView) @@ -78,31 +65,29 @@ public void show() { MaterialDialog md = mdb.build(); View view = md.getCustomView(); - TextView IDX_value = (TextView) view.findViewById(R.id.IDX_value); - - TextView weather_forecast_title = (TextView) view.findViewById(R.id.weather_forcast); - TextView weather_humidity_title = (TextView) view.findViewById(R.id.weather_humidity); - TextView weather_barometer_title = (TextView) view.findViewById(R.id.weather_barometer); - TextView weather_dewpoint_title = (TextView) view.findViewById(R.id.weather_drewpoint); - TextView weather_temperature_title = (TextView) view.findViewById(R.id.weather_temperature); - TextView weather_chill_title = (TextView) view.findViewById(R.id.weather_chill); - TextView weather_direction_title = (TextView) view.findViewById(R.id.weather_direction); - TextView weather_speed_title = (TextView) view.findViewById(R.id.weather_speed); - - TextView weather_forecast = (TextView) view.findViewById(R.id.weather_forcast_value); - TextView weather_humidity = (TextView) view.findViewById(R.id.weather_humidity_value); - TextView weather_barometer = (TextView) view.findViewById(R.id.weather_barometer_value); - TextView weather_dewpoint = (TextView) view.findViewById(R.id.weather_drewpoint_value); - TextView weather_temperature = (TextView) view.findViewById(R.id.weather_temperature_value); - TextView weather_chill = (TextView) view.findViewById(R.id.weather_chill_value); - TextView weather_direction = (TextView) view.findViewById(R.id.weather_direction_value); - TextView weather_speed = (TextView) view.findViewById(R.id.weather_speed_value); + TextView IDX_value = view.findViewById(R.id.IDX_value); + TextView weather_forecast_title = view.findViewById(R.id.weather_forcast); + TextView weather_humidity_title = view.findViewById(R.id.weather_humidity); + TextView weather_barometer_title = view.findViewById(R.id.weather_barometer); + TextView weather_dewpoint_title = view.findViewById(R.id.weather_drewpoint); + TextView weather_temperature_title = view.findViewById(R.id.weather_temperature); + TextView weather_chill_title = view.findViewById(R.id.weather_chill); + TextView weather_direction_title = view.findViewById(R.id.weather_direction); + TextView weather_speed_title = view.findViewById(R.id.weather_speed); + TextView weather_forecast = view.findViewById(R.id.weather_forcast_value); + TextView weather_humidity = view.findViewById(R.id.weather_humidity_value); + TextView weather_barometer = view.findViewById(R.id.weather_barometer_value); + TextView weather_dewpoint = view.findViewById(R.id.weather_drewpoint_value); + TextView weather_temperature = view.findViewById(R.id.weather_temperature_value); + TextView weather_chill = view.findViewById(R.id.weather_chill_value); + TextView weather_direction = view.findViewById(R.id.weather_direction_value); + TextView weather_speed = view.findViewById(R.id.weather_speed_value); IDX_value.setText(String.valueOf(info.getIdx())); - TextView LastUpdate_value = (TextView) view.findViewById(R.id.LastUpdate_value); + TextView LastUpdate_value = view.findViewById(R.id.LastUpdate_value); LastUpdate_value.setText(info.getLastUpdate()); - favorite_switch = (Switch) view.findViewById(R.id.favorite_switch); + favorite_switch = view.findViewById(R.id.favorite_switch); favorite_switch.setChecked(info.getFavoriteBoolean()); favorite_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/java/nl/hnogames/domoticz/Utils/UsefulBits.java b/app/src/main/java/nl/hnogames/domoticz/Utils/UsefulBits.java index 3d71c0554..78cbd4faf 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Utils/UsefulBits.java +++ b/app/src/main/java/nl/hnogames/domoticz/Utils/UsefulBits.java @@ -608,8 +608,7 @@ public static void checkAPK(final Context context, final SharedPrefUtil mSharedP //TODO: Implement correct piracychecker for this app!! mSharedPrefs.setAPKValidated(true); return; - } - else { + } else { // release build PiracyChecker oPiracyChecker = new PiracyChecker(context); oPiracyChecker diff --git a/app/src/main/java/nl/hnogames/domoticz/Utils/WidgetUtils.java b/app/src/main/java/nl/hnogames/domoticz/Utils/WidgetUtils.java index 0590da0d4..181c12ea5 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Utils/WidgetUtils.java +++ b/app/src/main/java/nl/hnogames/domoticz/Utils/WidgetUtils.java @@ -35,42 +35,47 @@ public class WidgetUtils { public static void RefreshWidgets(Context context) { - //refresh all widgets - AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); - ComponentName widgetComponent = new ComponentName(context, WidgetProviderLarge.class); - int[] appWidgetIds = widgetManager.getAppWidgetIds(widgetComponent); - for (int appWidgetId : appWidgetIds) { - Intent updateIntent = new Intent(context, WidgetProviderLarge.UpdateWidgetService.class); - updateIntent.putExtra(EXTRA_APPWIDGET_ID, appWidgetId); - updateIntent.setAction("FROM WIDGET PROVIDER"); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - context.startForegroundService(updateIntent); - else - context.startService(updateIntent); - } + if (context == null) + return; + try { + //refresh all widgets + AppWidgetManager widgetManager = AppWidgetManager.getInstance(context); + ComponentName widgetComponent = new ComponentName(context, WidgetProviderLarge.class); + int[] appWidgetIds = widgetManager.getAppWidgetIds(widgetComponent); + for (int appWidgetId : appWidgetIds) { + Intent updateIntent = new Intent(context, WidgetProviderLarge.UpdateWidgetService.class); + updateIntent.putExtra(EXTRA_APPWIDGET_ID, appWidgetId); + updateIntent.setAction("FROM WIDGET PROVIDER"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(updateIntent); + else + context.startService(updateIntent); + } - ComponentName widgetSecurityComponent = new ComponentName(context, SecurityWidgetProvider.class); - int[] appSecurityWidgetIds = widgetManager.getAppWidgetIds(widgetSecurityComponent); - for (int appSecurityWidgetId : appSecurityWidgetIds) { - Intent updateIntent = new Intent(context, SecurityWidgetProvider.UpdateSecurityWidgetService.class); - updateIntent.putExtra(EXTRA_APPWIDGET_ID, appSecurityWidgetId); - updateIntent.setAction("FROM WIDGET PROVIDER"); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - context.startForegroundService(updateIntent); - else - context.startService(updateIntent); - } + ComponentName widgetSecurityComponent = new ComponentName(context, SecurityWidgetProvider.class); + int[] appSecurityWidgetIds = widgetManager.getAppWidgetIds(widgetSecurityComponent); + for (int appSecurityWidgetId : appSecurityWidgetIds) { + Intent updateIntent = new Intent(context, SecurityWidgetProvider.UpdateSecurityWidgetService.class); + updateIntent.putExtra(EXTRA_APPWIDGET_ID, appSecurityWidgetId); + updateIntent.setAction("FROM WIDGET PROVIDER"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(updateIntent); + else + context.startService(updateIntent); + } - ComponentName smallwidgetComponent = new ComponentName(context, WidgetProviderSmall.class); - int[] appSmallWidgetIds = widgetManager.getAppWidgetIds(smallwidgetComponent); - for (int appSmallWidgetId : appSmallWidgetIds) { - Intent updateIntent = new Intent(context, WidgetProviderSmall.UpdateWidgetService.class); - updateIntent.putExtra(EXTRA_APPWIDGET_ID, appSmallWidgetId); - updateIntent.setAction("FROM WIDGET PROVIDER"); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - context.startForegroundService(updateIntent); - else - context.startService(updateIntent); + ComponentName smallwidgetComponent = new ComponentName(context, WidgetProviderSmall.class); + int[] appSmallWidgetIds = widgetManager.getAppWidgetIds(smallwidgetComponent); + for (int appSmallWidgetId : appSmallWidgetIds) { + Intent updateIntent = new Intent(context, WidgetProviderSmall.UpdateWidgetService.class); + updateIntent.putExtra(EXTRA_APPWIDGET_ID, appSmallWidgetId); + updateIntent.setAction("FROM WIDGET PROVIDER"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(updateIntent); + else + context.startService(updateIntent); + } + } catch (Exception ex) { } } } \ No newline at end of file diff --git a/app/src/main/java/nl/hnogames/domoticz/Welcome/SetupServerSettings.java b/app/src/main/java/nl/hnogames/domoticz/Welcome/SetupServerSettings.java index 7113e57ce..431bdc39f 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Welcome/SetupServerSettings.java +++ b/app/src/main/java/nl/hnogames/domoticz/Welcome/SetupServerSettings.java @@ -26,6 +26,7 @@ import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; +import android.support.design.widget.TextInputEditText; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.text.InputType; @@ -38,7 +39,6 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; -import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.Switch; @@ -72,19 +72,18 @@ public class SetupServerSettings extends Fragment implements OnPermissionCallbac private SharedPrefUtil mSharedPrefs; private ServerUtil mServerUtil; - private EditText remote_server_input, remote_port_input, + private TextInputEditText remote_server_input, remote_port_input, remote_username_input, remote_password_input, remote_directory_input, local_server_input, local_password_input, local_username_input, local_port_input, local_directory_input, server_name_input; - private Spinner remote_protocol_spinner, local_protocol_spinner, startScreen_spinner; + private Spinner remote_protocol_spinner, local_protocol_spinner; private Switch localServer_switch; - private int remoteProtocolSelectedPosition, localProtocolSelectedPosition, startScreenSelectedPosition; + private int remoteProtocolSelectedPosition, localProtocolSelectedPosition; private View v; private boolean hasBeenVisibleToUser = false; private MultiSelectionSpinner local_wifi_spinner; private PhoneConnectionUtil mPhoneConnectionUtil; - private Switch advancedSettings_switch; private ServerInfo newServer; private boolean isUpdateRequest = false; @@ -142,27 +141,25 @@ public void setUserVisibleHint(boolean isVisibleToUser) { } private void getLayoutReferences() { - Button saveButton = (Button) v.findViewById(R.id.save_server); - server_name_input = (EditText) v.findViewById(R.id.server_name_input); - remote_server_input = (EditText) v.findViewById(R.id.remote_server_input); - remote_port_input = (EditText) v.findViewById(R.id.remote_port_input); - remote_username_input = (EditText) v.findViewById(R.id.remote_username_input); - remote_password_input = (EditText) v.findViewById(R.id.remote_password_input); - remote_directory_input = (EditText) v.findViewById(R.id.remote_directory_input); - remote_protocol_spinner = (Spinner) v.findViewById(R.id.remote_protocol_spinner); - local_server_input = (EditText) v.findViewById(R.id.local_server_input); - local_port_input = (EditText) v.findViewById(R.id.local_port_input); - local_username_input = (EditText) v.findViewById(R.id.local_username_input); - local_password_input = (EditText) v.findViewById(R.id.local_password_input); - local_directory_input = (EditText) v.findViewById(R.id.local_directory_input); - local_protocol_spinner = (Spinner) v.findViewById(R.id.local_protocol_spinner); - local_wifi_spinner = (MultiSelectionSpinner) v.findViewById(R.id.local_wifi); - CheckBox cbShowPassword = (CheckBox) v.findViewById(R.id.showpassword); - CheckBox cbShowPasswordLocal = (CheckBox) v.findViewById(R.id.showpasswordlocal); - - startScreen_spinner = (Spinner) v.findViewById(R.id.startScreen_spinner); - - Button btnManualSSID = (Button) v.findViewById(R.id.set_ssid); + Button saveButton = v.findViewById(R.id.save_server); + server_name_input = v.findViewById(R.id.server_name_input); + remote_server_input = v.findViewById(R.id.remote_server_input); + remote_port_input = v.findViewById(R.id.remote_port_input); + remote_username_input = v.findViewById(R.id.remote_username_input); + remote_password_input = v.findViewById(R.id.remote_password_input); + remote_directory_input = v.findViewById(R.id.remote_directory_input); + remote_protocol_spinner = v.findViewById(R.id.remote_protocol_spinner); + local_server_input = v.findViewById(R.id.local_server_input); + local_port_input = v.findViewById(R.id.local_port_input); + local_username_input = v.findViewById(R.id.local_username_input); + local_password_input = v.findViewById(R.id.local_password_input); + local_directory_input = v.findViewById(R.id.local_directory_input); + local_protocol_spinner = v.findViewById(R.id.local_protocol_spinner); + local_wifi_spinner = v.findViewById(R.id.local_wifi); + CheckBox cbShowPassword = v.findViewById(R.id.showpassword); + CheckBox cbShowPasswordLocal = v.findViewById(R.id.showpasswordlocal); + Button btnManualSSID = v.findViewById(R.id.set_ssid); + btnManualSSID.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -191,13 +188,10 @@ public void onInput(@NonNull MaterialDialog dialog, CharSequence input) { } }); - startScreen_spinner.setVisibility(View.GONE); - v.findViewById(R.id.startScreen_title).setVisibility(View.GONE); v.findViewById(R.id.server_settings_title).setVisibility(View.GONE); - final LinearLayout localServerSettingsLayout = (LinearLayout) - v.findViewById(R.id.local_server_settings); - localServer_switch = (Switch) v.findViewById(R.id.localServer_switch); + final LinearLayout localServerSettingsLayout = v.findViewById(R.id.local_server_settings); + localServer_switch = v.findViewById(R.id.localServer_switch); localServer_switch.setChecked(false);//default setting localServer_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -206,29 +200,15 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { else localServerSettingsLayout.setVisibility(View.GONE); } }); - - final LinearLayout advancedSettings_layout = (LinearLayout) - v.findViewById(R.id.advancedSettings_layout); - advancedSettings_switch = (Switch) v.findViewById(R.id.advancedSettings_switch); - advancedSettings_layout.setVisibility(View.INVISIBLE); - advancedSettings_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mSharedPrefs.setAdvancedSettingsEnabled(isChecked); - - if (isChecked) advancedSettings_layout.setVisibility(View.VISIBLE); - else advancedSettings_layout.setVisibility(View.GONE); - } - }); - advancedSettings_layout.setVisibility(View.GONE); - advancedSettings_switch.setChecked(false); cbShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!isChecked) { - remote_password_input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); + remote_password_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + remote_password_input.setSelection(remote_password_input.getText().length()); } else { remote_password_input.setInputType(InputType.TYPE_CLASS_TEXT); + remote_password_input.setSelection(remote_password_input.getText().length()); } } }); @@ -236,13 +216,14 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!isChecked) { - local_password_input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); + local_password_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + local_password_input.setSelection(local_password_input.getText().length()); } else { local_password_input.setInputType(InputType.TYPE_CLASS_TEXT); + local_password_input.setSelection(local_password_input.getText().length()); } } }); - saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -302,16 +283,12 @@ private void setPreferenceValues() { local_server_input.setText(newServer.getLocalServerUrl()); local_port_input.setText(newServer.getLocalServerPort()); local_directory_input.setText(newServer.getLocalServerDirectory()); - localServer_switch.setChecked(newServer.getIsLocalServerAddressDifferent()); - advancedSettings_switch.setChecked(newServer.getIsLocalServerAddressDifferent()); } else { remote_username_input.setText(""); } setProtocol_spinner(); - setStartScreen_spinner(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (!PermissionsUtil.canAccessLocation(getActivity())) { permissionFragmentHelper.request(PermissionsUtil.INITIAL_LOCATION_PERMS); @@ -402,32 +379,7 @@ public void onNothingSelected(AdapterView adapterView) { }); } - private void setStartScreen_spinner() { - if (mSharedPrefs == null) - mSharedPrefs = new SharedPrefUtil(getActivity().getApplicationContext()); - - String[] startScreens = getResources().getStringArray(R.array.drawer_actions); - ArrayAdapter startScreenAdapter - = new ArrayAdapter<>(getActivity(), R.layout.spinner_list_item, startScreens); - - startScreen_spinner.setAdapter(startScreenAdapter); - if (mSharedPrefs != null) - startScreen_spinner.setSelection(mSharedPrefs.getStartupScreenIndex()); - startScreen_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView adapterView, - View view, int position, long id) { - startScreenSelectedPosition = position; - } - - @Override - public void onNothingSelected(AdapterView adapterView) { - } - }); - } - private void buildServerInfo() { - newServer = new ServerInfo(); newServer.setRemoteServerUsername( remote_username_input.getText().toString().trim()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage2.java b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage2.java index 17ed2eae1..35a7378b0 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage2.java +++ b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage2.java @@ -61,7 +61,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, SettingsFile = new File(Environment.getExternalStorageDirectory(), "/Domoticz/DomoticzSettings.txt"); permissionFragmentHelper = PermissionFragmentHelper.getInstance(this); - Button importButton = (Button) v.findViewById(R.id.import_settings); + Button importButton = v.findViewById(R.id.import_settings); importButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage3.java b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage3.java index c9435bef6..b1debc0b3 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage3.java +++ b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomePage3.java @@ -26,6 +26,7 @@ import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; +import android.support.design.widget.TextInputEditText; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.text.InputType; @@ -38,7 +39,6 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; -import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.Switch; @@ -69,14 +69,14 @@ public class WelcomePage3 extends Fragment implements OnPermissionCallback { private SharedPrefUtil mSharedPrefs; private ServerUtil mServerUtil; - private EditText remote_server_input, remote_port_input, + private TextInputEditText remote_server_input, remote_port_input, remote_username_input, remote_password_input, remote_directory_input, local_server_input, local_password_input, local_username_input, local_port_input, local_directory_input; - private Spinner remote_protocol_spinner, local_protocol_spinner, startScreen_spinner; + private Spinner remote_protocol_spinner, local_protocol_spinner; private Switch localServer_switch; - private int remoteProtocolSelectedPosition, localProtocolSelectedPosition, startScreenSelectedPosition; + private int remoteProtocolSelectedPosition, localProtocolSelectedPosition; private View v; private boolean hasBeenVisibleToUser = false; private MultiSelectionSpinner local_wifi_spinner; @@ -87,11 +87,9 @@ public class WelcomePage3 extends Fragment implements OnPermissionCallback { public static WelcomePage3 newInstance(int instance) { WelcomePage3 f = new WelcomePage3(); - Bundle bdl = new Bundle(1); bdl.putInt(INSTANCE, instance); f.setArguments(bdl); - return f; } @@ -129,25 +127,23 @@ public void setUserVisibleHint(boolean isVisibleToUser) { } private void getLayoutReferences() { + remote_server_input = v.findViewById(R.id.remote_server_input); + remote_port_input = v.findViewById(R.id.remote_port_input); + remote_username_input = v.findViewById(R.id.remote_username_input); + remote_password_input = v.findViewById(R.id.remote_password_input); + remote_directory_input = v.findViewById(R.id.remote_directory_input); + remote_protocol_spinner = v.findViewById(R.id.remote_protocol_spinner); + local_server_input = v.findViewById(R.id.local_server_input); + local_port_input = v.findViewById(R.id.local_port_input); + local_username_input = v.findViewById(R.id.local_username_input); + local_password_input = v.findViewById(R.id.local_password_input); + local_directory_input = v.findViewById(R.id.local_directory_input); + local_protocol_spinner = v.findViewById(R.id.local_protocol_spinner); + local_wifi_spinner = v.findViewById(R.id.local_wifi); + CheckBox cbShowPassword = v.findViewById(R.id.showpassword); + CheckBox cbShowPasswordLocal = v.findViewById(R.id.showpasswordlocal); + Button btnManualSSID = v.findViewById(R.id.set_ssid); - remote_server_input = (EditText) v.findViewById(R.id.remote_server_input); - remote_port_input = (EditText) v.findViewById(R.id.remote_port_input); - remote_username_input = (EditText) v.findViewById(R.id.remote_username_input); - remote_password_input = (EditText) v.findViewById(R.id.remote_password_input); - remote_directory_input = (EditText) v.findViewById(R.id.remote_directory_input); - remote_protocol_spinner = (Spinner) v.findViewById(R.id.remote_protocol_spinner); - local_server_input = (EditText) v.findViewById(R.id.local_server_input); - local_port_input = (EditText) v.findViewById(R.id.local_port_input); - local_username_input = (EditText) v.findViewById(R.id.local_username_input); - local_password_input = (EditText) v.findViewById(R.id.local_password_input); - local_directory_input = (EditText) v.findViewById(R.id.local_directory_input); - local_protocol_spinner = (Spinner) v.findViewById(R.id.local_protocol_spinner); - local_wifi_spinner = (MultiSelectionSpinner) v.findViewById(R.id.local_wifi); - CheckBox cbShowPassword = (CheckBox) v.findViewById(R.id.showpassword); - CheckBox cbShowPasswordLocal = (CheckBox) v.findViewById(R.id.showpasswordlocal); - - startScreen_spinner = (Spinner) v.findViewById(R.id.startScreen_spinner); - Button btnManualSSID = (Button) v.findViewById(R.id.set_ssid); btnManualSSID.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -177,16 +173,11 @@ public void onInput(@NonNull MaterialDialog dialog, CharSequence input) { }); if (callingInstance == SETTINGS) { - // Hide these settings if being called by settings (instead of welcome wizard) - startScreen_spinner.setVisibility(View.GONE); - v.findViewById(R.id.startScreen_title).setVisibility(View.GONE); v.findViewById(R.id.server_settings_title).setVisibility(View.GONE); } - final LinearLayout localServerSettingsLayout = (LinearLayout) - v.findViewById(R.id.local_server_settings); - - localServer_switch = (Switch) v.findViewById(R.id.localServer_switch); + final LinearLayout localServerSettingsLayout = v.findViewById(R.id.local_server_settings); + localServer_switch = v.findViewById(R.id.localServer_switch); localServer_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled()); localServer_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -196,34 +187,15 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { } }); localServerSettingsLayout.setVisibility(mServerUtil.getActiveServer().getIsLocalServerAddressDifferent() ? View.VISIBLE : View.GONE); - - final LinearLayout advancedSettings_layout = (LinearLayout) - v.findViewById(R.id.advancedSettings_layout); - - Switch advancedSettings_switch = (Switch) v.findViewById(R.id.advancedSettings_switch); - advancedSettings_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled()); - advancedSettings_layout.setVisibility(mServerUtil.getActiveServer().getIsLocalServerAddressDifferent() ? View.VISIBLE : View.GONE); - - if (mSharedPrefs.isAdvancedSettingsEnabled()) - advancedSettings_layout.setVisibility(View.VISIBLE); - - advancedSettings_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mSharedPrefs.setAdvancedSettingsEnabled(isChecked); - - if (isChecked) advancedSettings_layout.setVisibility(View.VISIBLE); - else advancedSettings_layout.setVisibility(View.GONE); - } - }); - cbShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!isChecked) { - remote_password_input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); + remote_password_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + remote_password_input.setSelection(remote_password_input.getText().length()); } else { remote_password_input.setInputType(InputType.TYPE_CLASS_TEXT); + remote_password_input.setSelection(remote_password_input.getText().length()); } } }); @@ -231,9 +203,11 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!isChecked) { - local_password_input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); + local_password_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + local_password_input.setSelection(local_password_input.getText().length()); } else { local_password_input.setInputType(InputType.TYPE_CLASS_TEXT); + local_password_input.setSelection(local_password_input.getText().length()); } } }); @@ -253,7 +227,6 @@ private void setPreferenceValues() { local_directory_input.setText(mServerUtil.getActiveServer().getLocalServerDirectory()); setProtocol_spinner(); - setStartScreen_spinner(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (!PermissionsUtil.canAccessLocation(getActivity())) { @@ -345,25 +318,6 @@ public void onNothingSelected(AdapterView adapterView) { }); } - private void setStartScreen_spinner() { - String[] startScreens = getResources().getStringArray(R.array.drawer_actions); - ArrayAdapter startScreenAdapter - = new ArrayAdapter<>(getActivity(), R.layout.spinner_list_item, startScreens); - startScreen_spinner.setAdapter(startScreenAdapter); - startScreen_spinner.setSelection(mSharedPrefs.getStartupScreenIndex()); - startScreen_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView adapterView, - View view, int position, long id) { - startScreenSelectedPosition = position; - } - - @Override - public void onNothingSelected(AdapterView adapterView) { - } - }); - } - private void writePreferenceValues() { mServerUtil.getActiveServer().setRemoteServerUsername( remote_username_input.getText().toString().trim()); @@ -377,10 +331,7 @@ private void writePreferenceValues() { remote_directory_input.getText().toString().trim()); mServerUtil.getActiveServer().setRemoteServerSecure( getSpinnerDomoticzRemoteSecureBoolean()); - if (callingInstance == WELCOME_WIZARD) - mSharedPrefs.setStartupScreenIndex(startScreenSelectedPosition); - - Switch useSameAddress = (Switch) v.findViewById(R.id.localServer_switch); + Switch useSameAddress = v.findViewById(R.id.localServer_switch); if (!useSameAddress.isChecked()) { mServerUtil.getActiveServer().setLocalSameAddressAsRemote(); mServerUtil.getActiveServer().setIsLocalServerAddressDifferent(false); diff --git a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomeViewActivity.java b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomeViewActivity.java index eb9061df3..66576f2d6 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomeViewActivity.java +++ b/app/src/main/java/nl/hnogames/domoticz/Welcome/WelcomeViewActivity.java @@ -42,10 +42,6 @@ public class WelcomeViewActivity extends IntroActivity { @Override protected void onCreate(Bundle savedInstanceState) { SharedPrefUtil mSharedPrefs = new SharedPrefUtil(this); - if (mSharedPrefs.darkThemeEnabled()) - setTheme(R.style.AppThemeDark); - else - setTheme(R.style.AppTheme); if (!UsefulBits.isEmpty(mSharedPrefs.getDisplayLanguage())) UsefulBits.setDisplayLanguage(this, mSharedPrefs.getDisplayLanguage()); diff --git a/app/src/main/java/nl/hnogames/domoticz/Widgets/SecurityWidgetConfigurationActivity.java b/app/src/main/java/nl/hnogames/domoticz/Widgets/SecurityWidgetConfigurationActivity.java index a294b77d2..eb365e053 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Widgets/SecurityWidgetConfigurationActivity.java +++ b/app/src/main/java/nl/hnogames/domoticz/Widgets/SecurityWidgetConfigurationActivity.java @@ -92,7 +92,7 @@ protected void onCreate(Bundle savedInstanceState) { editPin = (EditText) this.findViewById(R.id.securitypin); if (mSharedPrefs.darkThemeEnabled()) { - btnConfig.setBackground(ContextCompat.getDrawable(this, R.drawable.button_status_dark)); + btnConfig.setBackground(ContextCompat.getDrawable(this, R.color.button_dark)); editPin.setTextColor(ContextCompat.getColor(this, R.color.white)); txtStatus.setTextColor(ContextCompat.getColor(this, R.color.white)); txtTitle.setTextColor(ContextCompat.getColor(this, R.color.white)); diff --git a/app/src/main/java/nl/hnogames/domoticz/Widgets/WidgetProviderSmall.java b/app/src/main/java/nl/hnogames/domoticz/Widgets/WidgetProviderSmall.java index 95a5b6f78..439a5a136 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Widgets/WidgetProviderSmall.java +++ b/app/src/main/java/nl/hnogames/domoticz/Widgets/WidgetProviderSmall.java @@ -76,7 +76,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, packageName = context.getPackageName(); // Get all ids ComponentName thisWidget = new ComponentName(context, - WidgetProviderSmall.class); + WidgetProviderSmall.class); int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget); if (allWidgetIds != null) { for (int mAppWidgetId : allWidgetIds) { @@ -110,11 +110,11 @@ public int onStartCommand(Intent intent, int flags, int startId) { } AppWidgetManager appWidgetManager = AppWidgetManager - .getInstance(UpdateWidgetService.this); + .getInstance(UpdateWidgetService.this); try { int incomingAppWidgetId = intent.getIntExtra(EXTRA_APPWIDGET_ID, - INVALID_APPWIDGET_ID); + INVALID_APPWIDGET_ID); if (incomingAppWidgetId != INVALID_APPWIDGET_ID) { try { updateAppWidget(appWidgetManager, incomingAppWidgetId); @@ -151,22 +151,22 @@ public void updateAppWidget(final AppWidgetManager appWidgetManager, views.setTextViewText(R.id.title, getApplicationContext().getString(R.string.action_speech)); views.setImageViewResource(R.id.rowIcon, R.drawable.mic); views.setOnClickPendingIntent(R.id.rowIcon, buildButtonPendingIntent( - UpdateWidgetService.this, - appWidgetId, - idx, - false, - true)); + UpdateWidgetService.this, + appWidgetId, + idx, + false, + true)); appWidgetManager.updateAppWidget(appWidgetId, views); } else if (idx == iQRCodeAction) { views.setTextViewText(R.id.desc, getApplicationContext().getString(R.string.qrcode_desc)); views.setTextViewText(R.id.title, getApplicationContext().getString(R.string.action_qrcode_scan)); views.setImageViewResource(R.id.rowIcon, R.drawable.qrcode); views.setOnClickPendingIntent(R.id.rowIcon, buildButtonPendingIntent( - UpdateWidgetService.this, - appWidgetId, - idx, - false, - true)); + UpdateWidgetService.this, + appWidgetId, + idx, + false, + true)); appWidgetManager.updateAppWidget(appWidgetId, views); } else { appWidgetManager.updateAppWidget(appWidgetId, views); @@ -189,7 +189,7 @@ public void onReceiveDevice(DevicesInfo s) { if (s.getCounterToday() != null && s.getCounterToday().length() > 0) text += " Today: " + s.getCounterToday(); if (s.getCounter() != null && s.getCounter().length() > 0 && - !s.getCounter().equals(s.getData())) + !s.getCounter().equals(s.getData())) text += " Total: " + s.getCounter(); views.setTextViewText(R.id.desc, text); @@ -197,11 +197,11 @@ public void onReceiveDevice(DevicesInfo s) { boolean newStatus = !s.getStatusBoolean();//toggle views.setOnClickPendingIntent(R.id.rowIcon, buildButtonPendingIntent( - UpdateWidgetService.this, - appWidgetId, - s.getIdx(), - newStatus, - true)); + UpdateWidgetService.this, + appWidgetId, + s.getIdx(), + newStatus, + true)); } views.setImageViewResource(R.id.rowIcon, DomoticzIcons.getDrawableIcon(s.getTypeImg(), s.getType(), s.getSwitchType(), true, s.getUseCustomImage(), s.getImage())); @@ -236,11 +236,11 @@ public void onReceiveScene(SceneInfo s) { 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)); + UpdateWidgetService.this, + appWidgetId, + idx, + !s.getStatusInBoolean(), + true)); } views.setImageViewResource(R.id.rowIcon, DomoticzIcons.getDrawableIcon(s.getType(), null, null, false, false, null)); @@ -291,7 +291,7 @@ private int withButtons(DevicesInfo s) { int withButton = 0; if (s != null) { if (s.getSwitchTypeVal() == 0 && - (UsefulBits.isEmpty(s.getSwitchType()))) { + (UsefulBits.isEmpty(s.getSwitchType()))) { switch (s.getType()) { case DomoticzValues.Scene.Type.SCENE: withButton = WITHBUTTON; diff --git a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzCardFragment.java b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzCardFragment.java index 9d78f72e4..48f569f60 100644 --- a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzCardFragment.java +++ b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzCardFragment.java @@ -136,8 +136,10 @@ public void onAttachFragment(Fragment fragment) { * Checks for a active connection */ public void checkConnection() { - List fragments = getFragmentManager().getFragments(); - onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); + if (listener == null) { + List fragments = getFragmentManager().getFragments(); + onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); + } mPhoneConnectionUtil = new PhoneConnectionUtil(getContext()); if (mPhoneConnectionUtil.isNetworkAvailable()) { diff --git a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzDashboardFragment.java b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzDashboardFragment.java index 504dfaf3f..a1fe045ed 100644 --- a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzDashboardFragment.java +++ b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzDashboardFragment.java @@ -215,7 +215,6 @@ public void onActivityCreated(Bundle savedInstanceState) { * @param fragment fragment to cast the DomoticzFragmentListener to */ public void onAttachFragment(Fragment fragment) { - fragmentName = fragment.toString(); try { @@ -240,9 +239,10 @@ public void showSpinner(boolean show) { * Checks for a active connection */ public void checkConnection() { - List fragments = getFragmentManager().getFragments(); - onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); - + if (listener == null) { + List fragments = getFragmentManager().getFragments(); + onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); + } mPhoneConnectionUtil = new PhoneConnectionUtil(getContext()); if (mPhoneConnectionUtil.isNetworkAvailable()) { addDebugText("Connection OK"); @@ -251,7 +251,6 @@ public void checkConnection() { listener.onConnectionFailed(); setErrorMessage(getString(R.string.error_notConnected)); } - ; } /** diff --git a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzRecyclerFragment.java b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzRecyclerFragment.java index 031534ce0..6ab28486c 100644 --- a/app/src/main/java/nl/hnogames/domoticz/app/DomoticzRecyclerFragment.java +++ b/app/src/main/java/nl/hnogames/domoticz/app/DomoticzRecyclerFragment.java @@ -61,7 +61,6 @@ public class DomoticzRecyclerFragment extends Fragment { public RecyclerView gridView; - public SwipeRefreshLayout mSwipeRefreshLayout; public CoordinatorLayout coordinatorLayout; public Domoticz mDomoticz; @@ -117,20 +116,17 @@ public void sortFragment(String sort) { } public void initViews(View root) { - - gridView = (RecyclerView) root.findViewById(R.id.my_recycler_view); + gridView = root.findViewById(R.id.my_recycler_view); if (mSharedPrefs == null) mSharedPrefs = new SharedPrefUtil(getContext()); - setGridViewLayout(); - coordinatorLayout = (CoordinatorLayout) root.findViewById(R.id.coordinatorLayout); - mSwipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe_refresh_layout); + coordinatorLayout = root.findViewById(R.id.coordinatorLayout); + mSwipeRefreshLayout = root.findViewById(R.id.swipe_refresh_layout); } public void setGridViewLayout() { try { boolean isTablet = false; - float screenWidth = 0; boolean isPortrait = false; if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) @@ -139,7 +135,6 @@ public void setGridViewLayout() { isTablet = ! ((MainActivity) getActivity()).onPhone; } - gridView.setHasFixedSize(true); if (isTablet) { @@ -192,7 +187,6 @@ public void onActivityCreated(Bundle savedInstanceState) { * @param fragment fragment to cast the DomoticzFragmentListener to */ public void onAttachFragment(Fragment fragment) { - fragmentName = fragment.toString(); try { @@ -217,9 +211,11 @@ public void showSpinner(boolean show) { * Checks for a active connection */ public void checkConnection() { - List fragments = getFragmentManager().getFragments(); - onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); - + if (listener == null) { + //Get listener + List fragments = getFragmentManager().getFragments(); + onAttachFragment(fragments.get(0) != null ? fragments.get(0) : fragments.get(1)); + } mPhoneConnectionUtil = new PhoneConnectionUtil(getContext()); if (mPhoneConnectionUtil.isNetworkAvailable()) { addDebugText("Connection OK"); @@ -311,29 +307,29 @@ public void addDebugText(String text) { private void setErrorLayoutMessage(String message) { hideListView(); - RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout); + RelativeLayout errorLayout = root.findViewById(R.id.errorLayout); if (errorLayout != null) { errorLayout.setVisibility(View.VISIBLE); - TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage); + TextView errorTextMessage = root.findViewById(R.id.errorTextMessage); errorTextMessage.setText(message); } else throw new RuntimeException( "Layout should have a RelativeLayout defined with the ID of errorLayout"); } public void setMessage(String message) { - RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout); + RelativeLayout errorLayout = root.findViewById(R.id.errorLayout); if (errorLayout != null) { errorLayout.setVisibility(View.VISIBLE); - ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage); + ImageView errorImage = root.findViewById(R.id.errorImage); errorImage.setImageResource(R.drawable.empty); errorImage.setAlpha(0.5f); errorImage.setVisibility(View.VISIBLE); - TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong); + TextView errorTextWrong = root.findViewById(R.id.errorTextWrong); errorTextWrong.setVisibility(View.GONE); - TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage); + TextView errorTextMessage = root.findViewById(R.id.errorTextMessage); errorTextMessage.setText(message); } else throw new RuntimeException( "Layout should have a RelativeLayout defined with the ID of errorLayout"); @@ -349,11 +345,11 @@ private void hideListView() { private void showDebugLayout() { try { if (root != null) { - LinearLayout debugLayout = (LinearLayout) root.findViewById(R.id.debugLayout); + LinearLayout debugLayout = root.findViewById(R.id.debugLayout); if (debugLayout != null) { debugLayout.setVisibility(View.VISIBLE); - debugText = (TextView) root.findViewById(R.id.debugText); + debugText = root.findViewById(R.id.debugText); if (debugText != null) { debugText.setMovementMethod(new ScrollingMovementMethod()); } diff --git a/app/src/main/java/nl/hnogames/domoticz/app/RefreshFragment.java b/app/src/main/java/nl/hnogames/domoticz/app/RefreshFragment.java new file mode 100644 index 000000000..724e5e41b --- /dev/null +++ b/app/src/main/java/nl/hnogames/domoticz/app/RefreshFragment.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 Domoticz - Mark Heinis + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package nl.hnogames.domoticz.app; + +import android.support.v4.app.Fragment; + +public class RefreshFragment extends Fragment { + public void RefreshFragment() { + } + + public void Filter(String newText) { + } + + public void sortFragment(String selectedSort) { + } +} \ No newline at end of file diff --git a/app/src/main/res/anim/enter_from_above.xml b/app/src/main/res/anim/enter_from_above.xml index 427c17731..f3c91c605 100644 --- a/app/src/main/res/anim/enter_from_above.xml +++ b/app/src/main/res/anim/enter_from_above.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="0%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/enter_from_left.xml b/app/src/main/res/anim/enter_from_left.xml index 25c2b9de7..09db2c3ca 100644 --- a/app/src/main/res/anim/enter_from_left.xml +++ b/app/src/main/res/anim/enter_from_left.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="0%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/enter_from_right.xml b/app/src/main/res/anim/enter_from_right.xml index 9095a7d20..3fa3032be 100644 --- a/app/src/main/res/anim/enter_from_right.xml +++ b/app/src/main/res/anim/enter_from_right.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="0%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/exit_to_above.xml b/app/src/main/res/anim/exit_to_above.xml index efd13ab6c..1aee37852 100644 --- a/app/src/main/res/anim/exit_to_above.xml +++ b/app/src/main/res/anim/exit_to_above.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="-100%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/exit_to_left.xml b/app/src/main/res/anim/exit_to_left.xml index 1a69a5d7a..fc3175b35 100644 --- a/app/src/main/res/anim/exit_to_left.xml +++ b/app/src/main/res/anim/exit_to_left.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="0%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/exit_to_right.xml b/app/src/main/res/anim/exit_to_right.xml index 528c1146b..ad802facb 100644 --- a/app/src/main/res/anim/exit_to_right.xml +++ b/app/src/main/res/anim/exit_to_right.xml @@ -21,11 +21,11 @@ --> + android:shareInterpolator="false"> + android:toYDelta="0%"/> \ No newline at end of file diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml index 589d2b322..8de2b5bb5 100644 --- a/app/src/main/res/anim/fade_in.xml +++ b/app/src/main/res/anim/fade_in.xml @@ -20,6 +20,8 @@ --> \ No newline at end of file + android:duration="@android:integer/config_mediumAnimTime" + android:interpolator="@android:interpolator/accelerate_quad" + android:propertyName="alpha" + android:valueFrom="0" + android:valueTo="1"/> \ No newline at end of file diff --git a/app/src/main/res/animator/fade_in.xml b/app/src/main/res/animator/fade_in.xml index 3413353ae..8de2b5bb5 100644 --- a/app/src/main/res/animator/fade_in.xml +++ b/app/src/main/res/animator/fade_in.xml @@ -20,8 +20,8 @@ --> \ No newline at end of file + android:duration="@android:integer/config_mediumAnimTime" + android:interpolator="@android:interpolator/accelerate_quad" + android:propertyName="alpha" + android:valueFrom="0" + android:valueTo="1"/> \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/baseline_dashboard_black_18.png b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_18.png new file mode 100644 index 000000000..82619cccd Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dashboard_black_24.png b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_24.png new file mode 100644 index 000000000..a1476f6d9 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dashboard_black_36.png b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_36.png new file mode 100644 index 000000000..ceda41aac Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dashboard_black_48.png b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_48.png new file mode 100644 index 000000000..ad14dfeb9 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dashboard_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dvr_black_18.png b/app/src/main/res/drawable-hdpi/baseline_dvr_black_18.png new file mode 100644 index 000000000..dfda3dcd8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dvr_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dvr_black_24.png b/app/src/main/res/drawable-hdpi/baseline_dvr_black_24.png new file mode 100644 index 000000000..e636c40b1 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dvr_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dvr_black_36.png b/app/src/main/res/drawable-hdpi/baseline_dvr_black_36.png new file mode 100644 index 000000000..5dd9ce4e9 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dvr_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_dvr_black_48.png b/app/src/main/res/drawable-hdpi/baseline_dvr_black_48.png new file mode 100644 index 000000000..e90df3db5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_dvr_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_highlight_black_18.png b/app/src/main/res/drawable-hdpi/baseline_highlight_black_18.png new file mode 100644 index 000000000..a4b91b120 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_highlight_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_highlight_black_24.png b/app/src/main/res/drawable-hdpi/baseline_highlight_black_24.png new file mode 100644 index 000000000..bd256390d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_highlight_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_highlight_black_36.png b/app/src/main/res/drawable-hdpi/baseline_highlight_black_36.png new file mode 100644 index 000000000..792947410 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_highlight_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_highlight_black_48.png b/app/src/main/res/drawable-hdpi/baseline_highlight_black_48.png new file mode 100644 index 000000000..881d6b0dd Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_highlight_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_18.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_18.png new file mode 100644 index 000000000..c89bcc71a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_24.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_24.png new file mode 100644 index 000000000..a8f262f7b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_36.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_36.png new file mode 100644 index 000000000..647420c7b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_48.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_48.png new file mode 100644 index 000000000..2b86cf6b8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_down_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_18.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_18.png new file mode 100644 index 000000000..bc2e6593e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_24.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_24.png new file mode 100644 index 000000000..5355a3a65 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_36.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_36.png new file mode 100644 index 000000000..ab8dda5e4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_48.png b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_48.png new file mode 100644 index 000000000..c9d5f2613 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_keyboard_arrow_up_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_opacity_black_18.png b/app/src/main/res/drawable-hdpi/baseline_opacity_black_18.png new file mode 100644 index 000000000..9a7ba5624 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_opacity_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_opacity_black_24.png b/app/src/main/res/drawable-hdpi/baseline_opacity_black_24.png new file mode 100644 index 000000000..61e1486ab Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_opacity_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_opacity_black_36.png b/app/src/main/res/drawable-hdpi/baseline_opacity_black_36.png new file mode 100644 index 000000000..99c86b049 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_opacity_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_opacity_black_48.png b/app/src/main/res/drawable-hdpi/baseline_opacity_black_48.png new file mode 100644 index 000000000..47a505688 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_opacity_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_stop_black_18.png b/app/src/main/res/drawable-hdpi/baseline_stop_black_18.png new file mode 100644 index 000000000..455434f40 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_stop_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_stop_black_24.png b/app/src/main/res/drawable-hdpi/baseline_stop_black_24.png new file mode 100644 index 000000000..75a09bb83 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_stop_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_stop_black_36.png b/app/src/main/res/drawable-hdpi/baseline_stop_black_36.png new file mode 100644 index 000000000..9f1bb3ac0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_stop_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_stop_black_48.png b/app/src/main/res/drawable-hdpi/baseline_stop_black_48.png new file mode 100644 index 000000000..9d6b65da7 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_stop_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_18.png b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_18.png new file mode 100644 index 000000000..9bc4a45ed Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_24.png b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_24.png new file mode 100644 index 000000000..9f88ea5ae Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_36.png b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_36.png new file mode 100644 index 000000000..1d0056c0c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_48.png b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_48.png new file mode 100644 index 000000000..b0375366d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_view_carousel_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_18.png b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_18.png new file mode 100644 index 000000000..76fb86fce Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_24.png b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_24.png new file mode 100644 index 000000000..0945adf69 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_36.png b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_36.png new file mode 100644 index 000000000..763153790 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_48.png b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_48.png new file mode 100644 index 000000000..36c685021 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_wb_sunny_black_48.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_info_black_18.png b/app/src/main/res/drawable-hdpi/outline_info_black_18.png new file mode 100644 index 000000000..2d678b039 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_info_black_18.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_info_black_24.png b/app/src/main/res/drawable-hdpi/outline_info_black_24.png new file mode 100644 index 000000000..6677f00f1 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_info_black_24.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_info_black_36.png b/app/src/main/res/drawable-hdpi/outline_info_black_36.png new file mode 100644 index 000000000..12947cfcb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_info_black_36.png differ diff --git a/app/src/main/res/drawable-hdpi/outline_info_black_48.png b/app/src/main/res/drawable-hdpi/outline_info_black_48.png new file mode 100644 index 000000000..975b1ba2e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/outline_info_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dashboard_black_18.png b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_18.png new file mode 100644 index 000000000..6b88f6f3f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dashboard_black_24.png b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_24.png new file mode 100644 index 000000000..70feae6d0 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dashboard_black_36.png b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_36.png new file mode 100644 index 000000000..a1476f6d9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dashboard_black_48.png b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_48.png new file mode 100644 index 000000000..c8e420f6e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dashboard_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dvr_black_18.png b/app/src/main/res/drawable-mdpi/baseline_dvr_black_18.png new file mode 100644 index 000000000..1c49f02a9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dvr_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dvr_black_24.png b/app/src/main/res/drawable-mdpi/baseline_dvr_black_24.png new file mode 100644 index 000000000..3aa79d52a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dvr_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dvr_black_36.png b/app/src/main/res/drawable-mdpi/baseline_dvr_black_36.png new file mode 100644 index 000000000..e636c40b1 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dvr_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_dvr_black_48.png b/app/src/main/res/drawable-mdpi/baseline_dvr_black_48.png new file mode 100644 index 000000000..7bd6c78db Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_dvr_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_highlight_black_18.png b/app/src/main/res/drawable-mdpi/baseline_highlight_black_18.png new file mode 100644 index 000000000..9ba7e5621 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_highlight_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_highlight_black_24.png b/app/src/main/res/drawable-mdpi/baseline_highlight_black_24.png new file mode 100644 index 000000000..e50ea7593 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_highlight_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_highlight_black_36.png b/app/src/main/res/drawable-mdpi/baseline_highlight_black_36.png new file mode 100644 index 000000000..bd256390d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_highlight_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_highlight_black_48.png b/app/src/main/res/drawable-mdpi/baseline_highlight_black_48.png new file mode 100644 index 000000000..e6dca4876 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_highlight_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_18.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_18.png new file mode 100644 index 000000000..9f3b0e27c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_24.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_24.png new file mode 100644 index 000000000..2a6f560d9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_36.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_36.png new file mode 100644 index 000000000..a8f262f7b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_48.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_48.png new file mode 100644 index 000000000..f984862cd Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_down_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_18.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_18.png new file mode 100644 index 000000000..fdf7f2c24 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_24.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_24.png new file mode 100644 index 000000000..fd82b1732 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_36.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_36.png new file mode 100644 index 000000000..5355a3a65 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_48.png b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_48.png new file mode 100644 index 000000000..540d3e15c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_keyboard_arrow_up_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_opacity_black_18.png b/app/src/main/res/drawable-mdpi/baseline_opacity_black_18.png new file mode 100644 index 000000000..da6e462ce Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_opacity_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_opacity_black_24.png b/app/src/main/res/drawable-mdpi/baseline_opacity_black_24.png new file mode 100644 index 000000000..33b981dd4 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_opacity_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_opacity_black_36.png b/app/src/main/res/drawable-mdpi/baseline_opacity_black_36.png new file mode 100644 index 000000000..61e1486ab Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_opacity_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_opacity_black_48.png b/app/src/main/res/drawable-mdpi/baseline_opacity_black_48.png new file mode 100644 index 000000000..f63a7047c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_opacity_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_stop_black_18.png b/app/src/main/res/drawable-mdpi/baseline_stop_black_18.png new file mode 100644 index 000000000..a21765cf3 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_stop_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_stop_black_24.png b/app/src/main/res/drawable-mdpi/baseline_stop_black_24.png new file mode 100644 index 000000000..39c6117d0 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_stop_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_stop_black_36.png b/app/src/main/res/drawable-mdpi/baseline_stop_black_36.png new file mode 100644 index 000000000..75a09bb83 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_stop_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_stop_black_48.png b/app/src/main/res/drawable-mdpi/baseline_stop_black_48.png new file mode 100644 index 000000000..dde84945f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_stop_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_18.png b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_18.png new file mode 100644 index 000000000..fb321448c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_24.png b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_24.png new file mode 100644 index 000000000..3f8280542 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_36.png b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_36.png new file mode 100644 index 000000000..9f88ea5ae Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_48.png b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_48.png new file mode 100644 index 000000000..86e54e0c6 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_view_carousel_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_18.png b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_18.png new file mode 100644 index 000000000..9a96baff8 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_24.png b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_24.png new file mode 100644 index 000000000..747cb7da8 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_36.png b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_36.png new file mode 100644 index 000000000..0945adf69 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_48.png b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_48.png new file mode 100644 index 000000000..5da77de52 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_wb_sunny_black_48.png differ diff --git a/app/src/main/res/drawable-mdpi/outline_info_black_18.png b/app/src/main/res/drawable-mdpi/outline_info_black_18.png new file mode 100644 index 000000000..5c8c88d79 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/outline_info_black_18.png differ diff --git a/app/src/main/res/drawable-mdpi/outline_info_black_24.png b/app/src/main/res/drawable-mdpi/outline_info_black_24.png new file mode 100644 index 000000000..73a33ab01 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/outline_info_black_24.png differ diff --git a/app/src/main/res/drawable-mdpi/outline_info_black_36.png b/app/src/main/res/drawable-mdpi/outline_info_black_36.png new file mode 100644 index 000000000..6677f00f1 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/outline_info_black_36.png differ diff --git a/app/src/main/res/drawable-mdpi/outline_info_black_48.png b/app/src/main/res/drawable-mdpi/outline_info_black_48.png new file mode 100644 index 000000000..398e6ce0b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/outline_info_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_18.png new file mode 100644 index 000000000..a1476f6d9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_24.png new file mode 100644 index 000000000..c8e420f6e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_36.png new file mode 100644 index 000000000..ad14dfeb9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_48.png new file mode 100644 index 000000000..8fad114fe Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dashboard_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dvr_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_18.png new file mode 100644 index 000000000..e636c40b1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dvr_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_24.png new file mode 100644 index 000000000..7bd6c78db Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dvr_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_36.png new file mode 100644 index 000000000..e90df3db5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_dvr_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_48.png new file mode 100644 index 000000000..361593e9c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_dvr_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_highlight_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_18.png new file mode 100644 index 000000000..bd256390d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_highlight_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_24.png new file mode 100644 index 000000000..e6dca4876 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_highlight_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_36.png new file mode 100644 index 000000000..881d6b0dd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_highlight_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_48.png new file mode 100644 index 000000000..481482599 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_highlight_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_18.png new file mode 100644 index 000000000..a8f262f7b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_24.png new file mode 100644 index 000000000..f984862cd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_36.png new file mode 100644 index 000000000..2b86cf6b8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_48.png new file mode 100644 index 000000000..ed15d783d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_down_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_18.png new file mode 100644 index 000000000..5355a3a65 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_24.png new file mode 100644 index 000000000..540d3e15c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_36.png new file mode 100644 index 000000000..c9d5f2613 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_48.png new file mode 100644 index 000000000..06b7adb66 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_keyboard_arrow_up_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_opacity_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_18.png new file mode 100644 index 000000000..61e1486ab Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_opacity_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_24.png new file mode 100644 index 000000000..f63a7047c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_opacity_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_36.png new file mode 100644 index 000000000..47a505688 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_opacity_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_48.png new file mode 100644 index 000000000..3c85bbb12 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_opacity_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_stop_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_stop_black_18.png new file mode 100644 index 000000000..75a09bb83 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_stop_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_stop_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_stop_black_24.png new file mode 100644 index 000000000..dde84945f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_stop_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_stop_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_stop_black_36.png new file mode 100644 index 000000000..9d6b65da7 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_stop_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_stop_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_stop_black_48.png new file mode 100644 index 000000000..5bc5a6cd1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_stop_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_18.png new file mode 100644 index 000000000..9f88ea5ae Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_24.png new file mode 100644 index 000000000..86e54e0c6 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_36.png new file mode 100644 index 000000000..b0375366d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_48.png new file mode 100644 index 000000000..dbac973f5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_view_carousel_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_18.png b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_18.png new file mode 100644 index 000000000..0945adf69 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_24.png b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_24.png new file mode 100644 index 000000000..5da77de52 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_36.png b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_36.png new file mode 100644 index 000000000..36c685021 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_48.png b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_48.png new file mode 100644 index 000000000..61a82f999 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_wb_sunny_black_48.png differ diff --git a/app/src/main/res/drawable-xhdpi/outline_info_black_18.png b/app/src/main/res/drawable-xhdpi/outline_info_black_18.png new file mode 100644 index 000000000..6677f00f1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/outline_info_black_18.png differ diff --git a/app/src/main/res/drawable-xhdpi/outline_info_black_24.png b/app/src/main/res/drawable-xhdpi/outline_info_black_24.png new file mode 100644 index 000000000..398e6ce0b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/outline_info_black_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/outline_info_black_36.png b/app/src/main/res/drawable-xhdpi/outline_info_black_36.png new file mode 100644 index 000000000..975b1ba2e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/outline_info_black_36.png differ diff --git a/app/src/main/res/drawable-xhdpi/outline_info_black_48.png b/app/src/main/res/drawable-xhdpi/outline_info_black_48.png new file mode 100644 index 000000000..3fc566206 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/outline_info_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_18.png new file mode 100644 index 000000000..ceda41aac Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_24.png new file mode 100644 index 000000000..ad14dfeb9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_36.png new file mode 100644 index 000000000..55110fd04 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_48.png new file mode 100644 index 000000000..bb705f3bc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dashboard_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_18.png new file mode 100644 index 000000000..5dd9ce4e9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_24.png new file mode 100644 index 000000000..e90df3db5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_36.png new file mode 100644 index 000000000..d72ad13a7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_48.png new file mode 100644 index 000000000..32b7bef98 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_dvr_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_18.png new file mode 100644 index 000000000..792947410 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_24.png new file mode 100644 index 000000000..881d6b0dd Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_36.png new file mode 100644 index 000000000..9a9c5e803 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_48.png new file mode 100644 index 000000000..9f251dc35 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_highlight_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_18.png new file mode 100644 index 000000000..647420c7b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_24.png new file mode 100644 index 000000000..2b86cf6b8 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_36.png new file mode 100644 index 000000000..5bd8945d6 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_48.png new file mode 100644 index 000000000..9fd353899 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_down_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_18.png new file mode 100644 index 000000000..ab8dda5e4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_24.png new file mode 100644 index 000000000..c9d5f2613 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_36.png new file mode 100644 index 000000000..a4afd4b34 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_48.png new file mode 100644 index 000000000..3ad77acb4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_keyboard_arrow_up_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_18.png new file mode 100644 index 000000000..99c86b049 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_24.png new file mode 100644 index 000000000..47a505688 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_36.png new file mode 100644 index 000000000..2f9270c7c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_48.png new file mode 100644 index 000000000..237e3644a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_opacity_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_stop_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_18.png new file mode 100644 index 000000000..9f1bb3ac0 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_stop_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_24.png new file mode 100644 index 000000000..9d6b65da7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_stop_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_36.png new file mode 100644 index 000000000..75f47c1bf Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_stop_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_48.png new file mode 100644 index 000000000..eac183db7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_stop_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_18.png new file mode 100644 index 000000000..1d0056c0c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_24.png new file mode 100644 index 000000000..b0375366d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_36.png new file mode 100644 index 000000000..12b0613e0 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_48.png new file mode 100644 index 000000000..b4391354c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_view_carousel_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_18.png b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_18.png new file mode 100644 index 000000000..763153790 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_24.png b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_24.png new file mode 100644 index 000000000..36c685021 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_36.png b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_36.png new file mode 100644 index 000000000..a536d885a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_48.png b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_48.png new file mode 100644 index 000000000..269901932 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_wb_sunny_black_48.png differ diff --git a/app/src/main/res/drawable-xxhdpi/outline_info_black_18.png b/app/src/main/res/drawable-xxhdpi/outline_info_black_18.png new file mode 100644 index 000000000..12947cfcb Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/outline_info_black_18.png differ diff --git a/app/src/main/res/drawable-xxhdpi/outline_info_black_24.png b/app/src/main/res/drawable-xxhdpi/outline_info_black_24.png new file mode 100644 index 000000000..975b1ba2e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/outline_info_black_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/outline_info_black_36.png b/app/src/main/res/drawable-xxhdpi/outline_info_black_36.png new file mode 100644 index 000000000..c304dd747 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/outline_info_black_36.png differ diff --git a/app/src/main/res/drawable-xxhdpi/outline_info_black_48.png b/app/src/main/res/drawable-xxhdpi/outline_info_black_48.png new file mode 100644 index 000000000..de39c6a24 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/outline_info_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_18.png new file mode 100644 index 000000000..ad14dfeb9 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_24.png new file mode 100644 index 000000000..8fad114fe Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_36.png new file mode 100644 index 000000000..bb705f3bc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_48.png new file mode 100644 index 000000000..e2fc973b4 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dashboard_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_18.png new file mode 100644 index 000000000..e90df3db5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_24.png new file mode 100644 index 000000000..361593e9c Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_36.png new file mode 100644 index 000000000..32b7bef98 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_48.png new file mode 100644 index 000000000..9b03086bc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_dvr_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_18.png new file mode 100644 index 000000000..881d6b0dd Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_24.png new file mode 100644 index 000000000..481482599 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_36.png new file mode 100644 index 000000000..9f251dc35 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_48.png new file mode 100644 index 000000000..31bf7cc0a Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_highlight_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_18.png new file mode 100644 index 000000000..2b86cf6b8 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_24.png new file mode 100644 index 000000000..ed15d783d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_36.png new file mode 100644 index 000000000..9fd353899 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_48.png new file mode 100644 index 000000000..f6248cde5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_down_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_18.png new file mode 100644 index 000000000..c9d5f2613 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_24.png new file mode 100644 index 000000000..06b7adb66 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_36.png new file mode 100644 index 000000000..3ad77acb4 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_48.png new file mode 100644 index 000000000..339b456dc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_keyboard_arrow_up_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_18.png new file mode 100644 index 000000000..47a505688 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_24.png new file mode 100644 index 000000000..3c85bbb12 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_36.png new file mode 100644 index 000000000..237e3644a Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_48.png new file mode 100644 index 000000000..7dcc2836e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_opacity_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_18.png new file mode 100644 index 000000000..9d6b65da7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_24.png new file mode 100644 index 000000000..5bc5a6cd1 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_36.png new file mode 100644 index 000000000..eac183db7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_48.png new file mode 100644 index 000000000..685a83e1f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_stop_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_18.png new file mode 100644 index 000000000..b0375366d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_24.png new file mode 100644 index 000000000..dbac973f5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_36.png new file mode 100644 index 000000000..b4391354c Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_48.png new file mode 100644 index 000000000..d833bc83b Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_view_carousel_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_18.png b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_18.png new file mode 100644 index 000000000..36c685021 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_24.png new file mode 100644 index 000000000..61a82f999 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_36.png b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_36.png new file mode 100644 index 000000000..269901932 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_48.png b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_48.png new file mode 100644 index 000000000..614beb3b7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_wb_sunny_black_48.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/outline_info_black_18.png b/app/src/main/res/drawable-xxxhdpi/outline_info_black_18.png new file mode 100644 index 000000000..975b1ba2e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/outline_info_black_18.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/outline_info_black_24.png b/app/src/main/res/drawable-xxxhdpi/outline_info_black_24.png new file mode 100644 index 000000000..3fc566206 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/outline_info_black_24.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/outline_info_black_36.png b/app/src/main/res/drawable-xxxhdpi/outline_info_black_36.png new file mode 100644 index 000000000..de39c6a24 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/outline_info_black_36.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/outline_info_black_48.png b/app/src/main/res/drawable-xxxhdpi/outline_info_black_48.png new file mode 100644 index 000000000..33022becd Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/outline_info_black_48.png differ diff --git a/app/src/main/res/drawable/appwidget_bg_clickable.xml b/app/src/main/res/drawable/appwidget_bg_clickable.xml index 468ae56d4..c90358191 100644 --- a/app/src/main/res/drawable/appwidget_bg_clickable.xml +++ b/app/src/main/res/drawable/appwidget_bg_clickable.xml @@ -20,7 +20,7 @@ --> - - - + + + diff --git a/app/src/main/res/drawable/appwidget_button_center.xml b/app/src/main/res/drawable/appwidget_button_center.xml index d462bcdac..5ba14c958 100644 --- a/app/src/main/res/drawable/appwidget_button_center.xml +++ b/app/src/main/res/drawable/appwidget_button_center.xml @@ -20,7 +20,7 @@ --> - - - + + + diff --git a/app/src/main/res/drawable/appwidget_button_left.xml b/app/src/main/res/drawable/appwidget_button_left.xml index 901bce8a2..4690bc24f 100644 --- a/app/src/main/res/drawable/appwidget_button_left.xml +++ b/app/src/main/res/drawable/appwidget_button_left.xml @@ -20,7 +20,7 @@ --> - - - + + + diff --git a/app/src/main/res/drawable/appwidget_button_right.xml b/app/src/main/res/drawable/appwidget_button_right.xml index 788b17434..5625ac07b 100644 --- a/app/src/main/res/drawable/appwidget_button_right.xml +++ b/app/src/main/res/drawable/appwidget_button_right.xml @@ -20,7 +20,7 @@ --> - - - + + + diff --git a/app/src/main/res/drawable/appwidget_dark_bg_clickable.xml b/app/src/main/res/drawable/appwidget_dark_bg_clickable.xml index e797d0e52..a965f2770 100644 --- a/app/src/main/res/drawable/appwidget_dark_bg_clickable.xml +++ b/app/src/main/res/drawable/appwidget_dark_bg_clickable.xml @@ -20,7 +20,7 @@ --> - - - + + + diff --git a/app/src/main/res/drawable/border.xml b/app/src/main/res/drawable/border.xml index 32a98b22a..ac1a5cf9b 100644 --- a/app/src/main/res/drawable/border.xml +++ b/app/src/main/res/drawable/border.xml @@ -21,8 +21,8 @@ --> + android:shape="rectangle"> + android:color="@color/material_grey_300"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/bordershadow.xml b/app/src/main/res/drawable/bordershadow.xml index fe6350bdf..b6e2a67f1 100644 --- a/app/src/main/res/drawable/bordershadow.xml +++ b/app/src/main/res/drawable/bordershadow.xml @@ -25,14 +25,14 @@ - - + + - - + + diff --git a/app/src/main/res/drawable/button_dark_status.xml b/app/src/main/res/drawable/button_dark_status.xml index 61518d5f7..8b7a4ffea 100644 --- a/app/src/main/res/drawable/button_dark_status.xml +++ b/app/src/main/res/drawable/button_dark_status.xml @@ -21,6 +21,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_dark_status_normal.xml b/app/src/main/res/drawable/button_dark_status_normal.xml index dbd7b7299..89d5fead1 100644 --- a/app/src/main/res/drawable/button_dark_status_normal.xml +++ b/app/src/main/res/drawable/button_dark_status_normal.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_dark_status_pressed.xml b/app/src/main/res/drawable/button_dark_status_pressed.xml index fc2586948..cd246f7bc 100644 --- a/app/src/main/res/drawable/button_dark_status_pressed.xml +++ b/app/src/main/res/drawable/button_dark_status_pressed.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> diff --git a/app/src/main/res/drawable/button_normal.xml b/app/src/main/res/drawable/button_normal.xml index 22605b2ae..d83b31627 100644 --- a/app/src/main/res/drawable/button_normal.xml +++ b/app/src/main/res/drawable/button_normal.xml @@ -21,19 +21,19 @@ --> - + android:shape="rectangle"> + + android:color="@color/material_grey_300"/> + android:top="2dp"/> + android:topRightRadius="3dp"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_on.xml b/app/src/main/res/drawable/button_on.xml index de336194e..e58e85824 100644 --- a/app/src/main/res/drawable/button_on.xml +++ b/app/src/main/res/drawable/button_on.xml @@ -21,6 +21,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_pressed.xml b/app/src/main/res/drawable/button_pressed.xml index 556f175be..35ae2b7de 100644 --- a/app/src/main/res/drawable/button_pressed.xml +++ b/app/src/main/res/drawable/button_pressed.xml @@ -21,19 +21,19 @@ --> - + android:shape="rectangle"> + + android:color="@color/material_grey_500_"/> + android:top="2dp"/> + android:topRightRadius="3dp"/> diff --git a/app/src/main/res/drawable/button_status.xml b/app/src/main/res/drawable/button_status.xml index 68f57f23a..0b95881a8 100644 --- a/app/src/main/res/drawable/button_status.xml +++ b/app/src/main/res/drawable/button_status.xml @@ -21,6 +21,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_status_dark.xml b/app/src/main/res/drawable/button_status_dark.xml index f7730561a..5b66521f0 100644 --- a/app/src/main/res/drawable/button_status_dark.xml +++ b/app/src/main/res/drawable/button_status_dark.xml @@ -21,6 +21,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_status_dark_normal.xml b/app/src/main/res/drawable/button_status_dark_normal.xml index db0e7dc6c..9b11f645a 100644 --- a/app/src/main/res/drawable/button_status_dark_normal.xml +++ b/app/src/main/res/drawable/button_status_dark_normal.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_status_dark_pressed.xml b/app/src/main/res/drawable/button_status_dark_pressed.xml index a6c1d0c25..21125bda8 100644 --- a/app/src/main/res/drawable/button_status_dark_pressed.xml +++ b/app/src/main/res/drawable/button_status_dark_pressed.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> diff --git a/app/src/main/res/drawable/button_status_normal.xml b/app/src/main/res/drawable/button_status_normal.xml index 88a1356d0..82e9c9114 100644 --- a/app/src/main/res/drawable/button_status_normal.xml +++ b/app/src/main/res/drawable/button_status_normal.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_status_pressed.xml b/app/src/main/res/drawable/button_status_pressed.xml index 94376ba4e..7e0fdda4b 100644 --- a/app/src/main/res/drawable/button_status_pressed.xml +++ b/app/src/main/res/drawable/button_status_pressed.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> diff --git a/app/src/main/res/drawable/button_white_status.xml b/app/src/main/res/drawable/button_white_status.xml index 747f9edd3..cfb971d61 100644 --- a/app/src/main/res/drawable/button_white_status.xml +++ b/app/src/main/res/drawable/button_white_status.xml @@ -21,6 +21,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_white_status_normal.xml b/app/src/main/res/drawable/button_white_status_normal.xml index d9ca64adc..4b8c7b860 100644 --- a/app/src/main/res/drawable/button_white_status_normal.xml +++ b/app/src/main/res/drawable/button_white_status_normal.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_white_status_pressed.xml b/app/src/main/res/drawable/button_white_status_pressed.xml index 7c57c2c6c..5e18cfacb 100644 --- a/app/src/main/res/drawable/button_white_status_pressed.xml +++ b/app/src/main/res/drawable/button_white_status_pressed.xml @@ -21,16 +21,16 @@ --> - + android:shape="rectangle"> + + android:top="2dp"/> + android:topRightRadius="3dp"/> diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index e499363b7..65a0300ac 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -3,112 +3,112 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" - android:viewportHeight="108.0" - android:viewportWidth="108.0"> + android:viewportWidth="108.0" + android:viewportHeight="108.0"> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF"/> + android:strokeWidth="0.8" + android:strokeColor="#66FFFFFF"/> diff --git a/app/src/main/res/drawable/palette.png b/app/src/main/res/drawable/palette.png new file mode 100644 index 000000000..54f6006f2 Binary files /dev/null and b/app/src/main/res/drawable/palette.png differ diff --git a/app/src/main/res/drawable/wheel.png b/app/src/main/res/drawable/wheel.png new file mode 100644 index 000000000..40be615ab Binary files /dev/null and b/app/src/main/res/drawable/wheel.png differ diff --git a/app/src/main/res/drawable/wheel_dark.png b/app/src/main/res/drawable/wheel_dark.png new file mode 100644 index 000000000..ae1fff13c Binary files /dev/null and b/app/src/main/res/drawable/wheel_dark.png differ diff --git a/app/src/main/res/drawable/wwpalette.png b/app/src/main/res/drawable/wwpalette.png new file mode 100644 index 000000000..48fd234ba Binary files /dev/null and b/app/src/main/res/drawable/wwpalette.png differ diff --git a/app/src/main/res/drawable/wwslider.png b/app/src/main/res/drawable/wwslider.png new file mode 100644 index 000000000..2505e273f Binary files /dev/null and b/app/src/main/res/drawable/wwslider.png differ diff --git a/app/src/main/res/layout-land/dialog_notifications.xml b/app/src/main/res/layout-land/dialog_notifications.xml index 4b180c0a9..62d3d0722 100644 --- a/app/src/main/res/layout-land/dialog_notifications.xml +++ b/app/src/main/res/layout-land/dialog_notifications.xml @@ -21,13 +21,13 @@ --> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + android:layout_height="300dp"/> \ No newline at end of file diff --git a/app/src/main/res/layout-land/fragment_welcome1.xml b/app/src/main/res/layout-land/fragment_welcome1.xml index 6b36e0d8e..a0ae9b96b 100644 --- a/app/src/main/res/layout-land/fragment_welcome1.xml +++ b/app/src/main/res/layout-land/fragment_welcome1.xml @@ -21,13 +21,13 @@ --> + android:id="@+id/root1" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/welcome_top_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingBottom="@dimen/activity_vertical_margin"> + android:src="@drawable/ic_domoticz_logo"/> + android:textSize="@dimen/text_size_welcomePage1_domoticzInfo"/> + android:textSize="@dimen/text_size_welcomePage1_swipeInfo"/> \ No newline at end of file diff --git a/app/src/main/res/layout-land/notification_row.xml b/app/src/main/res/layout-land/notification_row.xml index 61d429369..92c0af129 100644 --- a/app/src/main/res/layout-land/notification_row.xml +++ b/app/src/main/res/layout-land/notification_row.xml @@ -21,10 +21,10 @@ --> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + tools:text="Switch name"/> + android:layout_alignParentLeft="true" + android:text="@string/battery_level"/> + android:text="@string/signal_level"/> \ No newline at end of file diff --git a/app/src/main/res/layout-sw720dp/activity_newmain_free.xml b/app/src/main/res/layout-sw720dp/activity_newmain_free.xml index 84ee2d1c7..e827a26db 100644 --- a/app/src/main/res/layout-sw720dp/activity_newmain_free.xml +++ b/app/src/main/res/layout-sw720dp/activity_newmain_free.xml @@ -18,7 +18,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> - @@ -52,7 +54,6 @@ @@ -63,13 +64,18 @@ android:visibility="gone" /> - - \ No newline at end of file + android:layout_weight="1" + android:gravity="bottom" + android:orientation="vertical" > + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_geo_settings.xml b/app/src/main/res/layout/activity_geo_settings.xml index 1652867a6..95ba52d15 100644 --- a/app/src/main/res/layout/activity_geo_settings.xml +++ b/app/src/main/res/layout/activity_geo_settings.xml @@ -20,10 +20,10 @@ --> + android:id="@+id/coordinatorLayout" + style="@style/background_listview" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingRight="@dimen/activity_horizontal_margin"> + android:text="@string/title_geofence"/> + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:text="@string/description_geofence"/> + android:paddingLeft="10dp"/> @@ -81,31 +81,31 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin"> + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingRight="@dimen/activity_horizontal_margin"> + android:text="@string/title_notification_geofence"/> + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + android:text="@string/description_notification_geofence"/> + android:paddingLeft="10dp"/> @@ -129,10 +129,10 @@ android:dividerHeight="@dimen/row_space" android:focusable="false" android:focusableInTouchMode="false" - android:paddingBottom="@dimen/row_space" android:paddingTop="@dimen/row_space" + android:paddingBottom="@dimen/row_space" android:scrollingCache="false" - android:smoothScrollbar="true" /> + android:smoothScrollbar="true"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 44c40fd8e..0103fc124 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -20,11 +20,11 @@ --> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity"> + app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> + tools:context=".MainActivity"/> + android:layout_gravity="start"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_newmain_free.xml b/app/src/main/res/layout/activity_newmain_free.xml index 9e777f628..f7c595850 100644 --- a/app/src/main/res/layout/activity_newmain_free.xml +++ b/app/src/main/res/layout/activity_newmain_free.xml @@ -18,51 +18,58 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + - - - + android:layout_weight="5" + android:layout_height="match_parent" + android:orientation="vertical"> - + - + + + - - \ No newline at end of file + android:layout_weight="1" + android:gravity="bottom" + android:orientation="vertical" > + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_newmain_paid.xml b/app/src/main/res/layout/activity_newmain_paid.xml index 11c641a7e..877c8150d 100644 --- a/app/src/main/res/layout/activity_newmain_paid.xml +++ b/app/src/main/res/layout/activity_newmain_paid.xml @@ -19,40 +19,41 @@ ~ under the License. --> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".MainActivity"> - - - + android:layout_height="match_parent" + android:orientation="vertical"> - + - + + + + ads:adUnitId="@string/ADMOB_ADS_KEY"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_nfc_settings.xml b/app/src/main/res/layout/activity_nfc_settings.xml index 4c4b49ce0..59a2f3e29 100644 --- a/app/src/main/res/layout/activity_nfc_settings.xml +++ b/app/src/main/res/layout/activity_nfc_settings.xml @@ -20,10 +20,10 @@ --> + android:id="@+id/coordinatorLayout" + style="@style/background_listview" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:smoothScrollbar="true"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_qrcode_settings.xml b/app/src/main/res/layout/activity_qrcode_settings.xml index 94aad8d7e..3e5e6be5d 100644 --- a/app/src/main/res/layout/activity_qrcode_settings.xml +++ b/app/src/main/res/layout/activity_qrcode_settings.xml @@ -20,10 +20,10 @@ --> + android:id="@+id/coordinatorLayout" + style="@style/background_listview" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:smoothScrollbar="true"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_server_settings.xml b/app/src/main/res/layout/activity_server_settings.xml index c3e4ddf51..8d1010bf1 100644 --- a/app/src/main/res/layout/activity_server_settings.xml +++ b/app/src/main/res/layout/activity_server_settings.xml @@ -20,10 +20,10 @@ --> + android:id="@+id/coordinatorLayout" + style="@style/background_listview" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:smoothScrollbar="true"/> diff --git a/app/src/main/res/layout/activity_speech_settings.xml b/app/src/main/res/layout/activity_speech_settings.xml index 810c2c8dd..f2484dd8d 100644 --- a/app/src/main/res/layout/activity_speech_settings.xml +++ b/app/src/main/res/layout/activity_speech_settings.xml @@ -20,17 +20,17 @@ --> + android:id="@+id/coordinatorLayout" + style="@style/background_listview" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:visibility="gone"/> + android:smoothScrollbar="true"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_update.xml b/app/src/main/res/layout/activity_update.xml index c0956fec3..e49eb715b 100644 --- a/app/src/main/res/layout/activity_update.xml +++ b/app/src/main/res/layout/activity_update.xml @@ -21,10 +21,10 @@ --> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity"> + android:paddingBottom="@dimen/activity_vertical_margin"> + android:src="@drawable/ic_domoticz_logo_white"/> + android:textSize="@dimen/text_size_large"/> + tools:text="2.4321"/> @@ -84,7 +84,7 @@ android:layout_height="wrap_content" android:layout_weight="75" android:text="@string/server_update_revision" - android:textSize="@dimen/text_size_large" /> + android:textSize="@dimen/text_size_large"/> + tools:text="2.5432"/> @@ -103,16 +103,16 @@ android:layout_marginTop="35dp" android:gravity="center_horizontal" android:text="@string/server_update_available" - android:textSize="@dimen/text_size_large" /> + android:textSize="@dimen/text_size_large"/> -