Skip to content

Commit

Permalink
Fixed null settings file issue & determine emote height by aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakota committed Apr 9, 2021
1 parent e495716 commit b773fd4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</p>

<h4 align="center">
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
</h4>

## Features
Expand Down
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
23 changes: 15 additions & 8 deletions android/app/src/main/res/layout/emote.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@
app:cardUseCompatPadding="true"
app:contentPadding="8dp">

<ImageView
android:id="@+id/EmoteImage"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:background="#ff464649"
android:cropToPadding="true"
android:scaleType="fitCenter" />
android:layout_height="wrap_content">

<ImageView
android:id="@+id/EmoteImage"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#ff464649"
android:cropToPadding="true"
android:scaleType="fitCenter"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
4 changes: 1 addition & 3 deletions android/app/src/main/res/layout/keyboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
</RelativeLayout>
7 changes: 4 additions & 3 deletions lib/models/pack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ class Pack extends ChangeNotifier implements JsonSerializable {

fromJson(Future<Map<String, dynamic>> futureJson) async {
var json = await futureJson;
_added = ((json['emotes'] ?? []) as List)
.map((item) => Emote.fromJson(item))
.toList();
List<dynamic>? emotes = json['emotes'];
if (emotes != null) {
_added = emotes.map((item) => Emote.fromJson(item)).toList();
}
notifyListeners();
}

Expand Down
6 changes: 4 additions & 2 deletions lib/models/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class Settings extends ChangeNotifier implements JsonSerializable {

fromJson(Future<Map<String, dynamic>> 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();
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b773fd4

Please sign in to comment.