Crash fixes

This commit is contained in:
Grishka 2022-11-08 09:36:56 +03:00
parent 1ac6a04a46
commit 159d91f390
3 changed files with 10 additions and 7 deletions

View File

@ -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){

View File

@ -91,6 +91,8 @@ public class SearchFragment extends BaseStatusListFragment<SearchResult>{
@Override
public void onItemClick(String id){
SearchResult res=getResultByID(id);
if(res==null)
return;
switch(res.type){
case ACCOUNT -> {
Bundle args=new Bundle();

View File

@ -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(){
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());
}
}