Be more explicit with running on main thread

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-10-04 14:56:31 -07:00
parent 99b2149deb
commit 42f613e722
4 changed files with 19 additions and 28 deletions

View File

@ -1262,19 +1262,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
@Override @Override
public void onModified(final Recipient recipient) { public void onModified(final Recipient recipient) {
titleView.post(new Runnable() { Util.runOnMain(() -> {
@Override titleView.setTitle(recipient);
public void run() { titleView.setVerified(identityRecords.isVerified());
titleView.setTitle(recipient); setBlockedUserState(recipient, isSecureText, isDefaultSms);
titleView.setVerified(identityRecords.isVerified()); setActionBarColor(recipient.getColor());
setBlockedUserState(recipient, isSecureText, isDefaultSms); setGroupShareProfileReminder(recipient);
setActionBarColor(recipient.getColor()); updateInviteReminder(recipient.hasSeenInviteReminder());
setGroupShareProfileReminder(recipient); updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId());
updateInviteReminder(recipient.hasSeenInviteReminder()); initializeSecurity(isSecureText, isDefaultSms);
updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId()); invalidateOptionsMenu();
initializeSecurity(isSecureText, isDefaultSms);
invalidateOptionsMenu();
}
}); });
} }

View File

@ -69,6 +69,7 @@ import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
import org.thoughtcrime.securesms.util.SaveAttachmentTask; import org.thoughtcrime.securesms.util.SaveAttachmentTask;
import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration; import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil; import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask; import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
@ -491,12 +492,7 @@ public class ConversationFragment extends Fragment
private void scrollToLastSeenPosition(final int lastSeenPosition) { private void scrollToLastSeenPosition(final int lastSeenPosition) {
if (lastSeenPosition > 0) { if (lastSeenPosition > 0) {
list.post(new Runnable() { Util.runOnMain(() -> ((LinearLayoutManager)list.getLayoutManager()).scrollToPositionWithOffset(lastSeenPosition, list.getHeight()));
@Override
public void run() {
((LinearLayoutManager)list.getLayoutManager()).scrollToPositionWithOffset(lastSeenPosition, list.getHeight());
}
});
} }
} }

View File

@ -223,7 +223,7 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
} }
expiresContainer.setVisibility(View.VISIBLE); expiresContainer.setVisibility(View.VISIBLE);
expiresInText.post(new Runnable() { Util.runOnMain(new Runnable() {
@Override @Override
public void run() { public void run() {
long elapsed = System.currentTimeMillis() - messageRecord.getExpireStarted(); long elapsed = System.currentTimeMillis() - messageRecord.getExpireStarted();
@ -233,7 +233,7 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
expiresInText.setText(duration); expiresInText.setText(duration);
if (running) { if (running) {
expiresInText.postDelayed(this, 500); Util.runOnMainDelayed(this, 500);
} }
} }
}); });

View File

@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.scribbles.widget.entity.ImageEntity;
import org.thoughtcrime.securesms.scribbles.widget.entity.MotionEntity; import org.thoughtcrime.securesms.scribbles.widget.entity.MotionEntity;
import org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity; import org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity;
import org.thoughtcrime.securesms.util.MediaUtil; import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture; import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -74,14 +75,11 @@ public class ScribbleActivity extends PassphraseRequiredActionBarActivity implem
} }
private void addSticker(final Bitmap pica) { private void addSticker(final Bitmap pica) {
scribbleView.post(new Runnable() { Util.runOnMain(() -> {
@Override Layer layer = new Layer();
public void run() { ImageEntity entity = new ImageEntity(layer, pica, scribbleView.getWidth(), scribbleView.getHeight());
Layer layer = new Layer();
ImageEntity entity = new ImageEntity(layer, pica, scribbleView.getWidth(), scribbleView.getHeight());
scribbleView.addEntityAndPosition(entity); scribbleView.addEntityAndPosition(entity);
}
}); });
} }