fix Glide crash in MainActivity (#1379)

* fix Glide crash in MainActivity

* make emojiInitCallback final
This commit is contained in:
Konrad Pozniak 2019-07-10 21:10:07 +02:00 committed by GitHub
parent 75734d0e91
commit bcd5262314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 6 deletions

View File

@ -120,6 +120,13 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
private int notificationTabPosition; private int notificationTabPosition;
private MainPagerAdapter adapter; private MainPagerAdapter adapter;
private final EmojiCompat.InitCallback emojiInitCallback = new EmojiCompat.InitCallback() {
@Override
public void onInitialized() {
updateProfiles();
}
};
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -309,6 +316,12 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
} }
} }
@Override
protected void onDestroy() {
super.onDestroy();
EmojiCompat.get().unregisterInitCallback(emojiInitCallback);
}
private void forwardShare(Intent intent) { private void forwardShare(Intent intent) {
Intent composeIntent = new Intent(this, ComposeActivity.class); Intent composeIntent = new Intent(this, ComposeActivity.class);
composeIntent.setAction(intent.getAction()); composeIntent.setAction(intent.getAction());
@ -438,12 +451,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
drawer.addItem(debugItem); drawer.addItem(debugItem);
} }
EmojiCompat.get().registerInitCallback(new EmojiCompat.InitCallback() { EmojiCompat.get().registerInitCallback(emojiInitCallback);
@Override
public void onInitialized() {
updateProfiles();
}
});
} }
private void setupTabs(boolean selectNotificationTab) { private void setupTabs(boolean selectNotificationTab) {