diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HashtagTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HashtagTimelineFragment.java index e919f9db..e8419d15 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HashtagTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HashtagTimelineFragment.java @@ -176,7 +176,7 @@ public class HashtagTimelineFragment extends StatusListFragment{ } private void updateHeader(){ - if(hashtag==null) + if(hashtag==null || getActivity()==null) return; if(hashtag.history!=null && !hashtag.history.isEmpty()){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java index 7eded409..00d4c06a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java @@ -822,7 +822,9 @@ public class PhotoViewer implements ZoomPanView.Listener{ @Override public boolean onError(MediaPlayer mp, int what, int extra){ Log.e(TAG, "video player onError() called with: mp = ["+mp+"], what = ["+what+"], extra = ["+extra+"]"); - return false; + Toast.makeText(activity, R.string.error_playing_video, Toast.LENGTH_SHORT).show(); + onStartSwipeToDismissTransition(0f); + return true; } public void prepareAndStartPlayer(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/ZoomPanView.java b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/ZoomPanView.java index 5425c095..31d9a78f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/ZoomPanView.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/ZoomPanView.java @@ -193,6 +193,9 @@ public class ZoomPanView extends FrameLayout implements ScaleGestureDetector.OnS private float prepareTransitionCropRect(Rect rect){ float initialScale; + if(rect.isEmpty()){ + rect.set(rect.centerX()-child.getWidth()/2, rect.centerY()-child.getHeight()/2, rect.centerX()+child.getWidth()/2, rect.centerY()+child.getWidth()/2); + } float scaleW=rect.width()/(float)child.getWidth(); float scaleH=rect.height()/(float)child.getHeight(); if(scaleW>scaleH){ diff --git a/mastodon/src/main/res/values/strings.xml b/mastodon/src/main/res/values/strings.xml index af28ff40..9ae6db2c 100644 --- a/mastodon/src/main/res/values/strings.xml +++ b/mastodon/src/main/res/values/strings.xml @@ -608,4 +608,6 @@ %,d post today %,d posts today + + Error playing video \ No newline at end of file