mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Use start/stop lifecycle callbacks rather than pause/resume.
Also fixed a couple of bugs.
This commit is contained in:
@@ -63,13 +63,21 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
loadSharedBy();
|
||||
loadSharedWith();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
sharedByAdapter.clear();
|
||||
sharedByList.showProgressBar();
|
||||
sharedWithAdapter.clear();
|
||||
sharedWithList.showProgressBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
@@ -97,11 +105,11 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
}
|
||||
|
||||
private void loadSharedBy() {
|
||||
dbController.runOnDbThread(new Runnable() {
|
||||
runOnDbThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ContactListItem> contactItems = new ArrayList<>();
|
||||
try {
|
||||
List<ContactListItem> contactItems = new ArrayList<>();
|
||||
for (Contact c : getSharedBy()) {
|
||||
LocalAuthor localAuthor = identityManager
|
||||
.getLocalAuthor(c.getLocalAuthorId());
|
||||
@@ -110,11 +118,11 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
groupId, new GroupCount(0, 0, 0));
|
||||
contactItems.add(item);
|
||||
}
|
||||
displaySharedBy(contactItems);
|
||||
} catch (DbException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
displaySharedBy(contactItems);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -123,21 +131,18 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
runOnUiThreadUnlessDestroyed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (contacts.isEmpty()) {
|
||||
sharedByList.showData();
|
||||
} else {
|
||||
sharedByAdapter.addAll(contacts);
|
||||
}
|
||||
if (contacts.isEmpty()) sharedByList.showData();
|
||||
else sharedByAdapter.addAll(contacts);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadSharedWith() {
|
||||
dbController.runOnDbThread(new Runnable() {
|
||||
runOnDbThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ContactListItem> contactItems = new ArrayList<>();
|
||||
try {
|
||||
List<ContactListItem> contactItems = new ArrayList<>();
|
||||
for (Contact c : getSharedWith()) {
|
||||
LocalAuthor localAuthor = identityManager
|
||||
.getLocalAuthor(c.getLocalAuthorId());
|
||||
@@ -146,11 +151,11 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
groupId, new GroupCount(0, 0, 0));
|
||||
contactItems.add(item);
|
||||
}
|
||||
displaySharedWith(contactItems);
|
||||
} catch (DbException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
displaySharedWith(contactItems);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -159,11 +164,8 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
runOnUiThreadUnlessDestroyed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (contacts.isEmpty()) {
|
||||
sharedWithList.showData();
|
||||
} else {
|
||||
sharedWithAdapter.addAll(contacts);
|
||||
}
|
||||
if (contacts.isEmpty()) sharedWithList.showData();
|
||||
else sharedWithAdapter.addAll(contacts);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user