diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/ResizedImageRequestBody.java b/mastodon/src/main/java/org/joinmastodon/android/api/ResizedImageRequestBody.java index 1bc67178..674f5dc4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/ResizedImageRequestBody.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/ResizedImageRequestBody.java @@ -12,6 +12,7 @@ import android.media.ExifInterface; import android.net.Uri; import android.os.Build; import android.provider.OpenableColumns; +import android.text.TextUtils; import org.joinmastodon.android.MastodonApp; import org.joinmastodon.android.ui.utils.UiUtils; @@ -48,6 +49,8 @@ public class ResizedImageRequestBody extends CountingRequestBody{ } contentType=MastodonApp.context.getContentResolver().getType(uri); } + if(TextUtils.isEmpty(contentType)) + contentType="image/jpeg"; if(needResize(opts.outWidth, opts.outHeight) || needCrop(opts.outWidth, opts.outHeight)){ Bitmap bitmap; if(Build.VERSION.SDK_INT>=28){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchFragment.java index 734fdf76..9f3f80c5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchFragment.java @@ -91,6 +91,8 @@ public class SearchFragment extends BaseStatusListFragment{ @Override public void onItemClick(String id){ SearchResult res=getResultByID(id); + if(res==null) + return; switch(res.type){ case ACCOUNT -> { Bundle args=new Bundle(); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java index f336d644..041627c0 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java @@ -200,7 +200,6 @@ public class SignupFragment extends AppKitFragment{ @Override public void onSuccess(Token result){ progressDialog.dismiss(); - progressDialog=null; Account fakeAccount=new Account(); fakeAccount.acct=fakeAccount.username=username; fakeAccount.id="tmp"+System.currentTimeMillis(); @@ -238,7 +237,6 @@ public class SignupFragment extends AppKitFragment{ error.showToast(getActivity()); } progressDialog.dismiss(); - progressDialog=null; } }) .exec(instance.uri, apiToken); @@ -255,9 +253,11 @@ public class SignupFragment extends AppKitFragment{ } private void showProgressDialog(){ - progressDialog=new ProgressDialog(getActivity()); - progressDialog.setMessage(getString(R.string.loading)); - progressDialog.setCancelable(false); + if(progressDialog==null){ + progressDialog=new ProgressDialog(getActivity()); + progressDialog.setMessage(getString(R.string.loading)); + progressDialog.setCancelable(false); + } progressDialog.show(); } @@ -280,7 +280,6 @@ public class SignupFragment extends AppKitFragment{ if(submitAfterGettingToken){ submitAfterGettingToken=false; progressDialog.dismiss(); - progressDialog=null; error.showToast(getActivity()); } } @@ -307,7 +306,6 @@ public class SignupFragment extends AppKitFragment{ if(submitAfterGettingToken){ submitAfterGettingToken=false; progressDialog.dismiss(); - progressDialog=null; error.showToast(getActivity()); } }