Fix some crashes
This commit is contained in:
parent
0a1c4f766d
commit
4feb4659a3
|
@ -478,7 +478,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
if (!activity.isDestroyed() && !activity.isFinishing() && url != null) {
|
if (!activity.isDestroyed() && !activity.isFinishing() && url != null) {
|
||||||
if (url.trim().isEmpty()) {
|
if (url.trim().isEmpty()) {
|
||||||
BitmapDrawable avatar = new AvatarGenerator.AvatarBuilder(activity)
|
BitmapDrawable avatar = new AvatarGenerator.AvatarBuilder(activity)
|
||||||
.setLabel(account.peertube_account.getAcct())
|
.setLabel(acct)
|
||||||
.setAvatarSize(120)
|
.setAvatarSize(120)
|
||||||
.setTextSize(30)
|
.setTextSize(30)
|
||||||
.toSquare()
|
.toSquare()
|
||||||
|
|
|
@ -126,8 +126,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachments == null || attachments.size() == 0)
|
if (attachments == null || attachments.size() == 0) {
|
||||||
finish();
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setTitle("");
|
setTitle("");
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
||||||
badgeCount = 0;
|
badgeCount = 0;
|
||||||
headerMenuOpen = false;
|
headerMenuOpen = false;
|
||||||
binding.navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
binding.navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
startInForeground();
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
||||||
peertubeInformation.setPrivacies(new LinkedHashMap<>());
|
peertubeInformation.setPrivacies(new LinkedHashMap<>());
|
||||||
peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>());
|
peertubeInformation.setPlaylistPrivacies(new LinkedHashMap<>());
|
||||||
peertubeInformation.setTranslations(new LinkedHashMap<>());
|
peertubeInformation.setTranslations(new LinkedHashMap<>());
|
||||||
startInForeground();
|
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
if (BuildConfig.FLAVOR.compareTo("playstore") == 0) {
|
if (BuildConfig.FLAVOR.compareTo("playstore") == 0) {
|
||||||
|
@ -417,11 +417,14 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
||||||
|
|
||||||
private void startInForeground() {
|
private void startInForeground() {
|
||||||
Intent notificationIntent = new Intent(this, RetrieveInfoService.class);
|
Intent notificationIntent = new Intent(this, RetrieveInfoService.class);
|
||||||
|
try {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(notificationIntent);
|
startForegroundService(notificationIntent);
|
||||||
} else {
|
} else {
|
||||||
startService(notificationIntent);
|
startService(notificationIntent);
|
||||||
}
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue