From b773fd4d85166ed906fcf438d5c31a9c303b93a5 Mon Sep 17 00:00:00 2001 From: Jonathan Bouchard Date: Fri, 9 Apr 2021 00:40:24 -0400 Subject: [PATCH] Fixed null settings file issue & determine emote height by aspect ratio --- README.md | 2 +- android/app/build.gradle | 1 + android/app/src/main/res/layout/emote.xml | 23 +++++++++++++------- android/app/src/main/res/layout/keyboard.xml | 4 +--- lib/models/pack.dart | 7 +++--- lib/models/settings.dart | 6 +++-- pubspec.yaml | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 07ea812..1076375 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

-Search and discover BTTV emotes to add to your keyboard stickers and use them anywhere +Search, discover and use BTTV emotes in any messaging apps using stickers

## Features diff --git a/android/app/build.gradle b/android/app/build.gradle index d5b0bce..0b7da48 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -86,5 +86,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.github.bumptech.glide:glide:4.12.0' implementation "androidx.cardview:cardview:1.0.0" + implementation "androidx.constraintlayout:constraintlayout:2.0.4" kapt 'com.github.bumptech.glide:compiler:4.12.0' } diff --git a/android/app/src/main/res/layout/emote.xml b/android/app/src/main/res/layout/emote.xml index 4f014a3..d159781 100644 --- a/android/app/src/main/res/layout/emote.xml +++ b/android/app/src/main/res/layout/emote.xml @@ -11,13 +11,20 @@ app:cardUseCompatPadding="true" app:contentPadding="8dp"> - + android:layout_height="wrap_content"> + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/keyboard.xml b/android/app/src/main/res/layout/keyboard.xml index 20c61f2..d8d82e4 100644 --- a/android/app/src/main/res/layout/keyboard.xml +++ b/android/app/src/main/res/layout/keyboard.xml @@ -10,8 +10,6 @@ android:id="@+id/EmoteList" android:layout_width="match_parent" android:layout_height="250dp" - android:horizontalSpacing="-5dp" android:numColumns="4" - android:stretchMode="columnWidth" - android:verticalSpacing="-5dp" /> + android:stretchMode="columnWidth" /> \ No newline at end of file diff --git a/lib/models/pack.dart b/lib/models/pack.dart index 6dbf8d0..b20cb57 100644 --- a/lib/models/pack.dart +++ b/lib/models/pack.dart @@ -54,9 +54,10 @@ class Pack extends ChangeNotifier implements JsonSerializable { fromJson(Future> futureJson) async { var json = await futureJson; - _added = ((json['emotes'] ?? []) as List) - .map((item) => Emote.fromJson(item)) - .toList(); + List? emotes = json['emotes']; + if (emotes != null) { + _added = emotes.map((item) => Emote.fromJson(item)).toList(); + } notifyListeners(); } diff --git a/lib/models/settings.dart b/lib/models/settings.dart index f87cf32..55fda8d 100644 --- a/lib/models/settings.dart +++ b/lib/models/settings.dart @@ -21,8 +21,10 @@ class Settings extends ChangeNotifier implements JsonSerializable { fromJson(Future> futureJson) async { var json = await futureJson; - _theme = - enumFromString(ThemeMode.values, json['theme']) ?? ThemeMode.system; + String? theme = json['theme']; + if (theme != null) { + _theme = enumFromString(ThemeMode.values, theme) ?? ThemeMode.system; + } notifyListeners(); } diff --git a/pubspec.yaml b/pubspec.yaml index 8809fd7..ae4f85a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 2.0.0+5 +version: 2.0.1+6 environment: sdk: ">=2.12.0 <3.0.0"