Skip to content

Commit

Permalink
Fixed: Selector switch buttons are corrupt #467
Browse files Browse the repository at this point in the history
Fixed: Selector switch buttons are corrupt #467
  • Loading branch information
Mark Heinis committed May 24, 2018
1 parent 04495f9 commit 299aafb
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 28 deletions.
29 changes: 13 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,26 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

def supportVersion = '27.1.1'
def playServicesVersion = '15.0.0'

implementation "com.android.support:support-v4:$supportVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:support-v13:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"

implementation "com.google.firebase:firebase-core:$playServicesVersion"
implementation "com.google.firebase:firebase-crash:$playServicesVersion"
implementation "com.google.firebase:firebase-perf:$playServicesVersion"
implementation "com.google.firebase:firebase-messaging:$playServicesVersion"
implementation "com.crashlytics.sdk.android:crashlytics:2.9.1"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-crash:16.0.0"
implementation "com.google.firebase:firebase-perf:16.0.0"
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.crashlytics.sdk.android:crashlytics:2.9.2"

implementation "com.google.android.gms:play-services-analytics:$playServicesVersion"
implementation "com.google.android.gms:play-services-wearable:$playServicesVersion"
implementation "com.google.android.gms:play-services-maps:$playServicesVersion"
implementation "com.google.android.gms:play-services-gcm:$playServicesVersion"
implementation "com.google.android.gms:play-services-location:$playServicesVersion"
implementation "com.google.android.gms:play-services-places:$playServicesVersion"
implementation "com.google.android.gms:play-services-ads:$playServicesVersion"
implementation "com.google.android.gms:play-services-analytics:16.0.0"
implementation "com.google.android.gms:play-services-wearable:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
implementation "com.google.android.gms:play-services-gcm:15.0.1"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-places:15.0.1"
implementation "com.google.android.gms:play-services-ads:15.0.1"

implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.code.gson:gson:2.8.0'
Expand All @@ -172,7 +170,6 @@ dependencies {
implementation 'jp.wasabeef:recyclerview-animators:2.2.4'
implementation 'com.github.javiersantos:PiracyChecker:1.1'
implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'

implementation('com.mikepenz:materialdrawer:5.8.2@aar') {
transitive = true
}
Expand All @@ -184,9 +181,9 @@ dependencies {
implementation 'com.github.zagum:SpeechRecognitionView:1.0.2'
implementation 'com.afollestad:digitus:0.3.0'

implementation project(path: ':materialIntro_library')
implementation project(':libs:MemorizingTrustManager')

implementation project(path: ':materialIntro_library')
implementation project(path: ':SeekArc_library')
implementation project(path: ':domoticzapi')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import nl.hnogames.domoticzapi.DomoticzValues;
import nl.hnogames.domoticzapi.Interfaces.DevicesReceiver;
import nl.hnogames.domoticzapi.Interfaces.setCommandReceiver;
import nl.hnogames.domoticzapi.Utils.PhoneConnectionUtil;

@DebugLog
public class Dashboard extends DomoticzDashboardFragment implements DomoticzFragmentListener,
Expand Down Expand Up @@ -1055,12 +1056,13 @@ private class GetCachedDataTask extends AsyncTask<Boolean, Boolean, Boolean> {
ArrayList<DevicesInfo> cacheSwitches = null;

protected Boolean doInBackground(Boolean... geto) {
if (mPhoneConnectionUtil == null)
mPhoneConnectionUtil = new PhoneConnectionUtil(mContext);
if (!mPhoneConnectionUtil.isNetworkAvailable()) {
try {
cacheSwitches = (ArrayList<DevicesInfo>) SerializableManager.readSerializedObject(mContext, "Dashboard");
} catch (Exception ex) {
}
}//no network available, load cache
} catch (Exception ex) { }
}
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed Apr 25 15:00:27 CEST 2018
VERSION_BUILD=4211
VERSION_PATCH=453
VERSION_CODE=278
#Thu May 24 16:13:26 CEST 2018
VERSION_BUILD=4252
VERSION_PATCH=456
VERSION_CODE=281
2 changes: 1 addition & 1 deletion domoticzapi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'

implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.android.volley:volley:1.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
package nl.hnogames.domoticzapi.Containers;

import android.support.annotation.NonNull;
import android.util.Base64;

import com.google.gson.GsonBuilder;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
Expand Down Expand Up @@ -131,9 +133,12 @@ public DevicesInfo(JSONObject row) throws JSONException {
Counter = row.getString("Counter");
if (row.has("Image"))
Image = row.getString("Image");

if (row.has("LevelNames"))
if (row.has("LevelNames")) {
LevelNames = row.getString("LevelNames");
if(UsefulBits.isBase64Encoded(LevelNames))
LevelNames = UsefulBits.decodeBase64(LevelNames);
}

if (row.has("CounterToday"))
CounterToday = row.getString("CounterToday");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.text.format.DateUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
Expand Down Expand Up @@ -167,6 +169,27 @@ public static String getPhoneDisplayLocale() {
}
}

/**
* @param text to be validated
* @return if the text is base 64 encoded or not
*/
public static boolean isBase64Encoded(String text){
return text.matches("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$");
}

/**
* @param text input value
* @return decode base 64 text
*/
public static String decodeBase64(String text){
byte[] data = Base64.decode(text, Base64.DEFAULT);
try {
return new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
return null;
}
}

/**
* Get's the relative formatted date
*
Expand Down
4 changes: 2 additions & 2 deletions domoticzapi/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed Apr 25 15:00:32 CEST 2018
VERSION_BUILD=3397
#Thu May 24 16:13:27 CEST 2018
VERSION_BUILD=3438
VERSION_PATCH=122
VERSION_CODE=122

0 comments on commit 299aafb

Please sign in to comment.