Store screenshot generator as UI test
This commit is contained in:
@@ -186,6 +186,9 @@ public class MastodonAPIController{
|
||||
req.onError("Error parsing an API error", response.code());
|
||||
}
|
||||
}
|
||||
}catch(Exception x){
|
||||
Log.w(TAG, "onResponse: error processing response", x);
|
||||
onFailure(call, (IOException) new IOException(x).fillInStackTrace());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.joinmastodon.android.api.requests.statuses;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
|
||||
public class GetStatusByID extends MastodonAPIRequest<Status>{
|
||||
public GetStatusByID(String id){
|
||||
super(HttpMethod.GET, "/statuses/"+id, Status.class);
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import me.grishka.appkit.Nav;
|
||||
import me.grishka.appkit.api.Callback;
|
||||
import me.grishka.appkit.api.ErrorResponse;
|
||||
@@ -796,6 +797,16 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public void addFakeMediaAttachment(Uri uri, String description){
|
||||
pollBtn.setEnabled(false);
|
||||
DraftMediaAttachment draft=new DraftMediaAttachment();
|
||||
draft.uri=uri;
|
||||
draft.description=description;
|
||||
attachmentsView.addView(createMediaAttachmentView(draft));
|
||||
allAttachments.add(draft);
|
||||
attachmentsView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void uploadMediaAttachment(DraftMediaAttachment attachment){
|
||||
if(uploadingAttachment!=null)
|
||||
throw new IllegalStateException("there is already an attachment being uploaded");
|
||||
|
||||
@@ -172,11 +172,13 @@ public class UiUtils{
|
||||
}
|
||||
|
||||
public static String getFileName(Uri uri){
|
||||
try(Cursor cursor=MastodonApp.context.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)){
|
||||
cursor.moveToFirst();
|
||||
String name=cursor.getString(0);
|
||||
if(name!=null)
|
||||
return name;
|
||||
if(uri.getScheme().equals("content")){
|
||||
try(Cursor cursor=MastodonApp.context.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)){
|
||||
cursor.moveToFirst();
|
||||
String name=cursor.getString(0);
|
||||
if(name!=null)
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return uri.getLastPathSegment();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user