Minor fixes

This commit is contained in:
Grishka 2023-06-30 09:18:48 +03:00
parent 273823a65f
commit eb822282c0
3 changed files with 10 additions and 4 deletions

View File

@ -65,6 +65,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.*;
@LargeTest @LargeTest
public class StoreScreenshotsGenerator{ public class StoreScreenshotsGenerator{
private static final String PHOTO_FILE="IMG_1010.jpg"; private static final String PHOTO_FILE="IMG_1010.jpg";
private static final long LOAD_WAIT_TIMEOUT=20_000;
@Rule @Rule
public ActivityScenarioRule<MainActivity> activityScenarioRule=new ActivityScenarioRule<>(MainActivity.class); public ActivityScenarioRule<MainActivity> activityScenarioRule=new ActivityScenarioRule<>(MainActivity.class);
@ -84,14 +85,14 @@ public class StoreScreenshotsGenerator{
AccountSession session=AccountSessionManager.getInstance().getAccount(AccountSessionManager.getInstance().getLastActiveAccountID()); AccountSession session=AccountSessionManager.getInstance().getAccount(AccountSessionManager.getInstance().getLastActiveAccountID());
MastodonApp.context.deleteDatabase(session.getID()+".db"); MastodonApp.context.deleteDatabase(session.getID()+".db");
onView(isRoot()).perform(waitId(R.id.more, 5000)); onView(isRoot()).perform(waitId(R.id.more, LOAD_WAIT_TIMEOUT));
Thread.sleep(500); Thread.sleep(500);
takeScreenshot("HomeTimeline"); takeScreenshot("HomeTimeline");
GlobalUserPreferences.theme=GlobalUserPreferences.ThemePreference.DARK; GlobalUserPreferences.theme=GlobalUserPreferences.ThemePreference.DARK;
activityScenarioRule.getScenario().recreate(); activityScenarioRule.getScenario().recreate();
onView(isRoot()).perform(waitId(R.id.more, 5000)); onView(isRoot()).perform(waitId(R.id.more, LOAD_WAIT_TIMEOUT));
Thread.sleep(500); Thread.sleep(500);
takeScreenshot("HomeTimeline_Dark"); takeScreenshot("HomeTimeline_Dark");
@ -100,8 +101,8 @@ public class StoreScreenshotsGenerator{
activityScenarioRule.getScenario().onActivity(activity->UiUtils.openProfileByID(activity, session.getID(), args.getString("profileAccountID"))); activityScenarioRule.getScenario().onActivity(activity->UiUtils.openProfileByID(activity, session.getID(), args.getString("profileAccountID")));
Thread.sleep(500); Thread.sleep(500);
onView(isRoot()).perform(waitId(R.id.avatar_border, 5000)); // wait for profile to load onView(isRoot()).perform(waitId(R.id.avatar_border, LOAD_WAIT_TIMEOUT)); // wait for profile to load
onView(isRoot()).perform(waitId(R.id.more, 5000)); // wait for timeline to load onView(isRoot()).perform(waitId(R.id.more, LOAD_WAIT_TIMEOUT)); // wait for timeline to load
Thread.sleep(500); Thread.sleep(500);
takeScreenshot("Profile"); takeScreenshot("Profile");

View File

@ -121,6 +121,8 @@ public class SearchFragment extends BaseStatusListFragment<SearchResult>{
}else{ }else{
type=null; type=null;
} }
if(currentQuery==null)
return;
currentRequest=new GetSearchResults(currentQuery, type, true) currentRequest=new GetSearchResults(currentQuery, type, true)
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){
@Override @Override

View File

@ -288,10 +288,13 @@ public class ComposeMediaViewController{
draft.uri=uri; draft.uri=uri;
draft.description=description; draft.description=description;
draft.mimeType="image/jpeg"; draft.mimeType="image/jpeg";
draft.fileSize=2473276;
draft.state=AttachmentUploadState.PROCESSING;
attachmentsView.addView(createMediaAttachmentView(draft)); attachmentsView.addView(createMediaAttachmentView(draft));
attachments.add(draft); attachments.add(draft);
attachmentsScroller.setVisibility(View.VISIBLE); attachmentsScroller.setVisibility(View.VISIBLE);
updateMediaAttachmentsLayout(); updateMediaAttachmentsLayout();
finishMediaAttachmentUpload(draft);
} }
private void uploadMediaAttachment(DraftMediaAttachment attachment){ private void uploadMediaAttachment(DraftMediaAttachment attachment){