Skip to content

Commit

Permalink
Fixed crashes related to Glide and null ArrayList in 1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mazurio committed Apr 7, 2016
1 parent 827263a commit 6bd67a6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
11 changes: 7 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ android {
productFlavors {
pro {
applicationId 'com.bodyweight.fitness.pro'
versionCode 118
versionName "1.1.8"
versionCode 119
versionName "1.1.9"
}

free {
applicationId 'com.bodyweight.fitness.free'
versionCode 118
versionName "1.1.8"
versionCode 119
versionName "1.1.9"
}
}
buildTypes {
Expand Down Expand Up @@ -134,9 +134,11 @@ buildscript {
maven {
url "http://repository.jetbrains.com/all"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.+'
}
}

Expand All @@ -145,4 +147,5 @@ repositories {
maven {
url "http://repository.jetbrains.com/all"
}
maven { url 'https://maven.fabric.io/public' }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.bodyweight.fitness.model.Routine;
import com.bodyweight.fitness.stream.RoutineStream;
import com.bodyweight.fitness.utils.Logger;
import com.bodyweight.fitness.view.PreviewView;

import com.bumptech.glide.Glide;
Expand All @@ -29,10 +30,14 @@ public void onSubscribe() {
.getResources()
.getIdentifier(exercise.getId(), "drawable", mView.getContext().getPackageName());

Glide.with(getContext())
.load(identifier)
.crossFade()
.into(imageViewTarget);
try {

This comment has been minimized.

Copy link
@mazurio

mazurio Apr 8, 2016

Author Owner

:(

Glide.with(getContext())
.load(identifier)
.crossFade()
.into(imageViewTarget);
} catch (Exception e) {
Logger.e("Glide exception " + e.getMessage());
}
} else {
String filePath = String.format("%s%s%s%s%s.gif",
FileDownloadUtils.getDefaultSaveRootPath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.bodyweight.fitness.stream.Stream;
import com.bodyweight.fitness.utils.ApplicationStoreUtils;
import com.bodyweight.fitness.utils.PreferenceUtils;
import com.bumptech.glide.Glide;

import java.util.ArrayList;

Expand Down Expand Up @@ -73,13 +74,6 @@ protected void onStop() {
.close();
}

@Override
protected void onDestroy() {
super.onDestroy();

// FileDownloader.getImpl().pauseAll();
}

@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt("ID", mId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.*

abstract class AbstractPresenter : Serializable {
@Transient
private val mSubscriptions: ArrayList<Subscription> = ArrayList()
private var mSubscriptions: ArrayList<Subscription> = ArrayList()

@Transient
var mView: AbstractView? = null
Expand All @@ -19,6 +19,10 @@ abstract class AbstractPresenter : Serializable {
}

open fun removeView() {
if (mSubscriptions == null) {
mSubscriptions = ArrayList()
}

for (s in mSubscriptions) {
s.unsubscribe()
}
Expand All @@ -27,6 +31,10 @@ abstract class AbstractPresenter : Serializable {
}

fun subscribe(subscription: Subscription) {
if (mSubscriptions == null) {
mSubscriptions = ArrayList()
}

mSubscriptions.add(subscription)
}
}

0 comments on commit 6bd67a6

Please sign in to comment.