1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00
This commit is contained in:
Austin Huang 2020-07-20 12:12:38 -04:00
parent 63cbe6d201
commit be45f52f7e
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -51,6 +52,7 @@ public final class ProfileViewer extends BaseLanguageActivity {
private FetchListener<String> fetchListener; private FetchListener<String> fetchListener;
private boolean errorHandled = false; private boolean errorHandled = false;
private boolean fallbackToProfile = false; private boolean fallbackToProfile = false;
private boolean destroyed = false;
@Override @Override
protected void onCreate(@Nullable final Bundle savedInstanceState) { protected void onCreate(@Nullable final Bundle savedInstanceState) {
@ -96,9 +98,9 @@ public final class ProfileViewer extends BaseLanguageActivity {
if (errorHandled && fallbackToProfile || Utils.isEmpty(profilePicUrl)) if (errorHandled && fallbackToProfile || Utils.isEmpty(profilePicUrl))
profilePicUrl = profileModel.getHdProfilePic(); profilePicUrl = profileModel.getHdProfilePic();
final RequestManager glideRequestManager = Glide.with(this); if (destroyed == true) return;
if (glideRequestManager == null) return; final RequestManager glideRequestManager = Glide.with(this);
glideRequestManager.load(profilePicUrl).addListener(new RequestListener<Drawable>() { glideRequestManager.load(profilePicUrl).addListener(new RequestListener<Drawable>() {
@Override @Override
@ -189,6 +191,13 @@ public final class ProfileViewer extends BaseLanguageActivity {
else if (error == 2) Toast.makeText(this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); else if (error == 2) Toast.makeText(this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
} }
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
destroyed = true;
}
@Override @Override
public boolean onCreateOptionsMenu(final Menu menu) { public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu); getMenuInflater().inflate(R.menu.menu, menu);