Browse Source

Fixed flickering

This is why AndroidX was required
main
M66B 6 years ago
parent
commit
7c39cc9cd1
10 changed files with 17 additions and 17 deletions
  1. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  2. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentAccounts.java
  3. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentCompose.java
  4. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentFolder.java
  5. +2
    -2
      app/src/main/java/eu/faircode/email/FragmentFolders.java
  6. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentIdentities.java
  7. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentIdentity.java
  8. +5
    -5
      app/src/main/java/eu/faircode/email/FragmentMessage.java
  9. +2
    -2
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  10. +2
    -2
      app/src/main/java/eu/faircode/email/FragmentSetup.java

+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -202,7 +202,7 @@ public class FragmentAccount extends FragmentEx {
long id = (args == null ? -1 : args.getLong("id", -1)); long id = (args == null ? -1 : args.getLong("id", -1));
// Observe // Observe
DB.getInstance(getContext()).account().liveAccount(id).observe(this, new Observer<EntityAccount>() {
DB.getInstance(getContext()).account().liveAccount(id).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
@Override @Override
public void onChanged(@Nullable EntityAccount account) { public void onChanged(@Nullable EntityAccount account) {
etName.setText(account == null ? null : account.name); etName.setText(account == null ? null : account.name);


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentAccounts.java View File

@ -90,7 +90,7 @@ public class FragmentAccounts extends FragmentEx {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
// Observe accounts // Observe accounts
DB.getInstance(getContext()).account().liveAccounts().observe(this, new Observer<List<EntityAccount>>() {
DB.getInstance(getContext()).account().liveAccounts().observe(getViewLifecycleOwner(), new Observer<List<EntityAccount>>() {
@Override @Override
public void onChanged(@Nullable List<EntityAccount> accounts) { public void onChanged(@Nullable List<EntityAccount> accounts) {
adapter.set(accounts); adapter.set(accounts);


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -190,7 +190,7 @@ public class FragmentCompose extends FragmentEx {
public void onActivityCreated(@Nullable Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
DB.getInstance(getContext()).identity().liveIdentities(true).observe(FragmentCompose.this, new Observer<List<EntityIdentity>>() {
DB.getInstance(getContext()).identity().liveIdentities(true).observe(getViewLifecycleOwner(), new Observer<List<EntityIdentity>>() {
@Override @Override
public void onChanged(@Nullable final List<EntityIdentity> identities) { public void onChanged(@Nullable final List<EntityIdentity> identities) {
Collections.sort(identities, new Comparator<EntityIdentity>() { Collections.sort(identities, new Comparator<EntityIdentity>() {


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentFolder.java View File

@ -101,7 +101,7 @@ public class FragmentFolder extends FragmentEx {
long id = (args == null ? -1 : args.getLong("id")); long id = (args == null ? -1 : args.getLong("id"));
// Observe // Observe
DB.getInstance(getContext()).folder().liveFolder(id).observe(this, new Observer<EntityFolder>() {
DB.getInstance(getContext()).folder().liveFolder(id).observe(getViewLifecycleOwner(), new Observer<EntityFolder>() {
@Override @Override
public void onChanged(@Nullable EntityFolder folder) { public void onChanged(@Nullable EntityFolder folder) {
if (folder != null) { if (folder != null) {


+ 2
- 2
app/src/main/java/eu/faircode/email/FragmentFolders.java View File

@ -90,7 +90,7 @@ public class FragmentFolders extends FragmentEx {
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());
// Observe account // Observe account
db.account().liveAccount(account).observe(this, new Observer<EntityAccount>() {
db.account().liveAccount(account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
@Override @Override
public void onChanged(@Nullable EntityAccount account) { public void onChanged(@Nullable EntityAccount account) {
setSubtitle(account.name); setSubtitle(account.name);
@ -98,7 +98,7 @@ public class FragmentFolders extends FragmentEx {
}); });
// Observe folders // Observe folders
db.folder().liveFolders(account).observe(this, new Observer<List<TupleFolderEx>>() {
db.folder().liveFolders(account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
@Override @Override
public void onChanged(@Nullable List<TupleFolderEx> folders) { public void onChanged(@Nullable List<TupleFolderEx> folders) {
adapter.set(folders); adapter.set(folders);


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentIdentities.java View File

@ -90,7 +90,7 @@ public class FragmentIdentities extends FragmentEx {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
// Observe identities // Observe identities
DB.getInstance(getContext()).identity().liveIdentities().observe(this, new Observer<List<EntityIdentity>>() {
DB.getInstance(getContext()).identity().liveIdentities().observe(getViewLifecycleOwner(), new Observer<List<EntityIdentity>>() {
@Override @Override
public void onChanged(@Nullable List<EntityIdentity> identities) { public void onChanged(@Nullable List<EntityIdentity> identities) {
adapter.set(identities); adapter.set(identities);


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentIdentity.java View File

@ -231,7 +231,7 @@ public class FragmentIdentity extends FragmentEx {
long id = (args == null ? -1 : args.getLong("id", -1)); long id = (args == null ? -1 : args.getLong("id", -1));
// Observer // Observer
DB.getInstance(getContext()).identity().liveIdentity(id).observe(this, new Observer<EntityIdentity>() {
DB.getInstance(getContext()).identity().liveIdentity(id).observe(getViewLifecycleOwner(), new Observer<EntityIdentity>() {
@Override @Override
public void onChanged(@Nullable EntityIdentity identity) { public void onChanged(@Nullable EntityIdentity identity) {
etName.setText(identity == null ? null : identity.name); etName.setText(identity == null ? null : identity.name);


+ 5
- 5
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -238,7 +238,7 @@ public class FragmentMessage extends FragmentEx {
final DB db = DB.getInstance(getContext()); final DB db = DB.getInstance(getContext());
// Observe message // Observe message
db.message().liveMessage(id).observe(this, new Observer<TupleMessageEx>() {
db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer<TupleMessageEx>() {
@Override @Override
public void onChanged(@Nullable final TupleMessageEx message) { public void onChanged(@Nullable final TupleMessageEx message) {
if (message == null || message.ui_hide) { if (message == null || message.ui_hide) {
@ -267,8 +267,8 @@ public class FragmentMessage extends FragmentEx {
tvFrom.setTextColor(colorUnseen); tvFrom.setTextColor(colorUnseen);
tvTime.setTextColor(colorUnseen); tvTime.setTextColor(colorUnseen);
db.attachment().liveAttachments(id).removeObservers(FragmentMessage.this);
db.attachment().liveAttachments(id).observe(FragmentMessage.this,
db.attachment().liveAttachments(id).removeObservers(getViewLifecycleOwner());
db.attachment().liveAttachments(id).observe(getViewLifecycleOwner(),
new Observer<List<TupleAttachment>>() { new Observer<List<TupleAttachment>>() {
@Override @Override
public void onChanged(@Nullable List<TupleAttachment> attachments) { public void onChanged(@Nullable List<TupleAttachment> attachments) {
@ -291,8 +291,8 @@ public class FragmentMessage extends FragmentEx {
bottom_navigation.setTag(message.folderType); bottom_navigation.setTag(message.folderType);
db.folder().liveFolders(message.account).removeObservers(FragmentMessage.this);
db.folder().liveFolders(message.account).observe(FragmentMessage.this, new Observer<List<TupleFolderEx>>() {
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
@Override @Override
public void onChanged(@Nullable final List<TupleFolderEx> folders) { public void onChanged(@Nullable final List<TupleFolderEx> folders) {
boolean hasTrash = false; boolean hasTrash = false;


+ 2
- 2
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -118,7 +118,7 @@ public class FragmentMessages extends FragmentEx {
setSubtitle(R.string.title_folder_unified); setSubtitle(R.string.title_folder_unified);
messages = new LivePagedListBuilder<>(db.message().pagedUnifiedInbox(debug), PAGE_SIZE).build(); messages = new LivePagedListBuilder<>(db.message().pagedUnifiedInbox(debug), PAGE_SIZE).build();
} else { } else {
db.folder().liveFolderEx(folder).observe(this, new Observer<TupleFolderEx>() {
db.folder().liveFolderEx(folder).observe(getViewLifecycleOwner(), new Observer<TupleFolderEx>() {
@Override @Override
public void onChanged(@Nullable TupleFolderEx folder) { public void onChanged(@Nullable TupleFolderEx folder) {
setSubtitle(folder == null ? null : Helper.localizeFolderName(getContext(), folder.name)); setSubtitle(folder == null ? null : Helper.localizeFolderName(getContext(), folder.name));
@ -132,7 +132,7 @@ public class FragmentMessages extends FragmentEx {
} }
Log.i(Helper.TAG, "Observing messages"); Log.i(Helper.TAG, "Observing messages");
messages.observe(this, new Observer<PagedList<TupleMessageEx>>() {
messages.observe(getViewLifecycleOwner(), new Observer<PagedList<TupleMessageEx>>() {
@Override @Override
public void onChanged(@Nullable PagedList<TupleMessageEx> messages) { public void onChanged(@Nullable PagedList<TupleMessageEx> messages) {
Log.i(Helper.TAG, "Submit messages=" + messages.size()); Log.i(Helper.TAG, "Submit messages=" + messages.size());


+ 2
- 2
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -178,14 +178,14 @@ public class FragmentSetup extends FragmentEx {
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());
db.account().liveAccounts(true).observe(this, new Observer<List<EntityAccount>>() {
db.account().liveAccounts(true).observe(getViewLifecycleOwner(), new Observer<List<EntityAccount>>() {
@Override @Override
public void onChanged(@Nullable List<EntityAccount> accounts) { public void onChanged(@Nullable List<EntityAccount> accounts) {
tvAccountDone.setVisibility(accounts.size() > 0 ? View.VISIBLE : View.INVISIBLE); tvAccountDone.setVisibility(accounts.size() > 0 ? View.VISIBLE : View.INVISIBLE);
} }
}); });
db.identity().liveIdentities(true).observe(this, new Observer<List<EntityIdentity>>() {
db.identity().liveIdentities(true).observe(getViewLifecycleOwner(), new Observer<List<EntityIdentity>>() {
@Override @Override
public void onChanged(@Nullable List<EntityIdentity> identities) { public void onChanged(@Nullable List<EntityIdentity> identities) {
tvIdentityDone.setVisibility(identities.size() > 0 ? View.VISIBLE : View.INVISIBLE); tvIdentityDone.setVisibility(identities.size() > 0 ? View.VISIBLE : View.INVISIBLE);


Loading…
Cancel
Save